I’m getting into wordpress and I’ve been following some pretty good tutorials and reading through the codex but I’ve encountered a problem which I can’t seem to find the answer to anywhere else. Eventually my plan is to create an interface for users of my theme that will allow them to change colors, widths, positioning, etc. of certain elements in the template. Basically it will be a php file that will generate a css document. For right now though all it does is echo a sentence. I’m not sure if this is technically a “plug-in” but when I try to put it in the plugins folder, I end up with a 404 error. I know the file is there and I have triple checked the path. I have also tried navigating to the php file directly in the url but I still get a 404 error. I have also tried using the plugin template. It echoes the sentence when I click “activate” in the plugins manager, but it does not work at all when calling it from the functions.php file. Any help is greatly appreciated.
Here is the code which I have placed at the end of my functions.php:
//begin template specific*******************************************************
//------the function below styles the wordpress admin menus.-------
function custom_style() {
echo '<style type="text/css">#adminmenu .wp-menu-image img {padding: 0px !important; margin-left: -3px;}</style>';
}
add_action('admin_menu', 'register_custom_menu_page');
add_action('admin_menu', 'custom_style');
//------this function adds the template specific menu item.---------
function register_custom_menu_page() {
add_menu_page('Epsilon', 'Epsilon', 'add_users', plugins_url('epsilon/eps-manage.php', eps-manage.php ), '', content_url('themes/epsilon/images/eps-icon.png'), 6);
} // this function creates the correct path as far as I can tell, but when I click the link button in the admin menu, I get the 404.
//------this function hides the editor option under the appearance menu ----------
function remove_editor_menu() {
remove_action('admin_menu', '_add_themes_utility_last', 101);
}
add_action('_admin_menu', 'remove_editor_menu', 1);
Why am i getting this 404 error and is there a more correct way to do this?
You are trying to merge a plugin and a theme. plugins_url will only load up the file of a registered and activated (not sure on the activation 100%) plugin, As you are developing a theme it is better to have your management files relative to your theme folder, but to be honest for this type of job as you are a begginer I would keep everything in functions.php and use functions as the callbacks to your menus.