wp_nav_menu() mark current item ancestor of custom post type

I do the following, it can be lengthy if you have many post types, feel free to edit it however: /** Edit Nav Menu calsses **/ function custom_wp_nav_classes($classes, $item){ global $post; $page_blog = get_option(‘page_for_posts’); if(is_tax(‘my_taxonomy_name_here’) || is_singular(‘my_post_type_name_here’)){ /** Remove Active Class from Blog **/ if($item->object_id == $page_blog) $classes = array_filter($classes, “remove_parent”); /** Page ID of … Read more

Allow Administrator role access to custom capabilities [duplicate]

Referring to the Codex entry for this, I suggest using another hook. They use the ‘admin_init’ action: function add_theme_caps() { $role = get_role( ‘author’ ); // gets the author role $role->add_cap( ‘edit_others_posts’ ); // would allow the author to edit others’ posts for current theme only } add_action( ‘admin_init’, ‘add_theme_caps’);

Add the current menu item CSS class to a custom page type archive in WordPress menu

This is what you want to do, add_filter( ‘wp_get_nav_menu_items’, ‘cpt_archive_menu_filter’, 10, 3 ); function cpt_archive_menu_filter( $items, $menu, $args ) { foreach ( $items as &$item ) { if ( $item->type != ‘custom’ ) continue; if ( get_query_var( ‘post_type’ ) == ‘your-post-type’ && $item->title == ‘Title of Link’ ) { $item->classes []= ‘class-name-your-want’; } } return … Read more

Add 32×32 icon to custom post type index page

If when using firebug you are seeing #icon-album.icon32.icon32-posts-album { background:url(‘<?php get_template_directory_uri(); ?>/images/album32x32.png’) no-repeat; } Then you’re passing the string ‘<?php get_template_directory_uri(); ?>/images/album32x32.png’ to the background property in your css file – and they don’t execute php code. If the image and CSS are in a theme folder (or at least the CSS file is in … Read more