• mattbirmingham

    (@mattbirmingham)


    NAVT is installed & working normally, except for the static page links. I have a static page (not posts) as my “home” page and posts are called “News.” I.e. WordPress Admin:Settings->Reading->Front Page Displays: A static page: Front Page: “Home”, Posts Page: “News”

    My NAVT menu looks like this:
    E.g.:
    Home | Stuff | News | Other Stuff | About

    Home, Stuff, Other Stuff and About are all “pages” and “News” is the link to posts.

    I have CSS applied to the current selected menu item through NAVT’s CSS option “LI active page CSS class” so when a menu item is selected, it remains highlighted. This works great for all menu items except “Home” and “News”, where no CSS is being emitted for the selected LI tag.

    When “About” is selected, the HTML emitted is:

    < li class="current">
    < a title="About" ...

    When Home or News is selected, no “class=’current'” is applied.

    Any/all help is appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter mattbirmingham

    (@mattbirmingham)

    BUMP!!! Can’t anyone provide some thoughts on this??

    where can i see this?

    I found the same problem.
    When you are in the static homepage then homepage item doesn’t have ‘current’ class applied.

    This has to do with how Navt figures out what page it’s on. If you have set up a static front page you have to edit get_current_location() in navt_fe.php line 837.

    Mind that these changes will probably break the plugin for the normal use case without the static front page. On line 847 the function starts figuring out the location and this is where it goes wrong.

    When you’ve set a static front page both the posts page and the front_page are of the type page but Navt sets them to TYPE_LINK which signifies an internal link.

    If these are set to TYPE_PAGE instead it works. You still can’t use the special home link but just grab the page you set instead and put that in the menu as home.

    Replace line 848 to 866 in navt_fe.php with this

    if( $wp_query->is_posts_page ) {
    	$p = get_page(get_option('page_for_posts'));
    	$loc['parent'] = '';
    	($p->post_type == 'page') ? $loc['page'] = TYPE_PAGE . $p->ID : $loc['page'] = TYPE_LINK . $p->ID;
    	$loc['set'] = 1;
    }
    
    if( $is_front_page && !$loc['set'] ) {
    	if ( 'posts' == get_option('show_on_front') && is_home() ) {
    		$loc['parent'] = '';
    		$loc['page'] = TYPE_LINK . HOMEIDN;
    		$loc['set'] = 1;
    	}
    	elseif('page' == get_option('show_on_front') && get_option('page_on_front') && is_page(get_option('page_on_front')) ) {
    		$p = get_page(get_option('page_on_front'));
    		$loc['parent'] = '';
    		($p->post_type == 'page') ? $loc['page'] = TYPE_PAGE . $p->ID : $loc['page'] = TYPE_LINK . $p->ID;
    		$loc['set'] = 1;
    	}
    }
    Joms

    (@jomsky)

    I did not manage to make the code above work so I just added this on the header.php file for my template:

    <?php if (is_front_page()) :?> $('#nav > li:first').addClass('current_page_item'); <?php endif; ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Plugin: WordPress Navigation List Plugin NAVT] No CSS applied to static post pages (Home/Posts)?’ is closed to new replies.