Tags » Wordpress 2

Flint - SoundCloud new track

Listen to Flint by brian anthony hardie #np on #SoundCloud

Thanks so much for your support.

Brian Anthony Hardie

Where Have I Been? See if You Can Tell

It’s a game for you to play if you want.

“Never apologize for not posting in a while. It just calls attention to it.” That’s advice I often give bloggers. 201 more words


Custom post type singular menu active class

// ====================================
// Custom post type singular menu active class
// ====================================
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Getting the post type of the current post
$current_post_type = get_post_type_object(get_post_type($post->ID));
$current_post_type_slug = $current_post_type->rewrite['slug'];

// Getting the URL of the menu item
$menu_slug = strtolower(trim($item->url));

// If the menu item URL contains the current post types slug add the current-menu-item class
if (strpos($menu_slug,$current_post_type_slug) !== false) {
$classes[] = 'current-menu-item';
else if( is_single() && $item->title == 'News' )
// Blog page set active menu
$classes[] = 'current-menu-item';
// Return the corrected set of classes to be added to the menu item
return $classes;
add_action('nav_menu_css_class', 'add_current_nav_class', 10, 2 );