Add a Custom Class to Admin Menus

The following does the job: add_action( ‘admin_init’,’wpse_60168_custom_menu_class’ ); function wpse_60168_custom_menu_class() { global $menu; foreach( $menu as $key => $value ) { if( ‘Posts’ == $value[0] ) $menu[$key][4] .= ” custom-class-1″; if( ‘Pages’ == $value[0] ) $menu[$key][4] .= ” custom-class-2″; } } And if you want to inspect what the $menu contains, use this: add_action( ‘admin_init’,’wpse_60168_var_dump_and_die’ … Read more

How can one utilize a variable as a callback function name for add_settings_field

Do not use different callbacks, use the the sixth parameter for add_settings_field() instead. That is an array, and you can pass any data to the callback here. Example: foreach( $theOptions as $k => $v ) { add_settings_field( $k, $v, ‘my_callback’, $the_options, $the_group, array ( ‘special’ => $k ) ); } function my_callback( $args ) { … Read more

Using FirePHP with WordPress

I use it including the file (Match you actual file location): require ‘../../FirePHPCore/fb.php’; and then call by using fb( $variable, ‘Message Title’); Be sure that you’ve installed and activated the FirePHP addon on Firefox. There’s also a WordPress plugin for FirePHP, but I’ve never used it.

Additional image sizes are not being generated

From https://make.wordpress.org/core/2012/12/06/wp_image_editor-is-incoming/ : Imagick support requires Imagick 2.2.0+ compiled against Imagemagick 6.2.9+, for full support. If the required functions aren’t available, WordPress will default back to GD. If you can, create a PHP file somewhere on your server with this content: <?php phpinfo(); ?>. Then load the page and see if there is a section … Read more

Custom Post Type .current-menu-item not applying on Custom Post Type Archive Page

I found an answer by searching in similar posts and links. I added a line to fit my needs (I wanted to prevent my blog page to get highlited when on a custom post).See this line: unset($classes[array_search(‘current_page_parent’,$classes)]); Solution function add_parent_url_menu_class( $classes = array(), $item = false ) { // Get current URL $current_url = current_url(); … Read more

Error when requesting password reset email – wp authentication

Sounds like a server configuration problem, not a WordPress thing. You said you were using Rackspace? I don’t have personal experience with Rackspace but it appears that they have some known issues with the default PHP mail() function. See: http://feedback.rackspace.com/forums/71021-product-feedback/suggestions/1873281-fully-support-php-mail-function- http://www.joshuawinn.com/huge-email-delays-on-rackspace-cloud-sites-dont-use-php-mail/ The primary issue is that sending straight through mail() doesn’t authenticate the sender, using … Read more

Strip Image Classes from HTML Output

Take a closer look at get_image_tag() which can take a lot of parameters like $id, $alt, $title, $align, $size. If you look even closer you’ll find the get_image_tag_class filter to change the image class names (like class, ID, align and size). You can use the filter within your functions.php like this: Note: This will still … Read more