• Hi all,

    I am having serious issues with getting my blog link to highlight https://www.kodekontrol.com/blogger/

    As you can see, About is set to be the static home page and the Blog is set for Posts. The thing is, when you click the blog link it doesn’t get highlighted with the current_page_item class. Also the page Title doesn’t appear as normal at the top left of the browser.
    This is a definite issue with wordpress so I was wondering if there was a work around which is futureproof.

    Any advice, apart from not using wordpress. I had heard so much about it, but this buggy issue has nearly put me off.

    Best
    Clint

Viewing 7 replies - 1 through 7 (of 7 total)
  • The whole issue is with poor theme design. Which theme are you using.

    Thread Starter modelreject

    (@modelreject)

    I’m using the default theme and there are so many themes out there I can’t find one that works.

    Any advice or themes that will work?

    Thanks Jeremy

    This is the code that I use maybe you can try it out and see if it will work for you.

    <ul>
    <?php
    $pg_li="page_item";
    if (is_home()) {$pg_li .=" current_page_item";}
    ?>
    <li class="<?php if (is_home()) echo'current_page_item' ?>"><a href="<?php bloginfo('url'); ?>" title="Home">Home</a></li>
    <?php wp_list_pages('title_li='); ?>
    </ul>

    Notice the if (is_home()) this tells wordpress that if the page that is currently being viewed then apply some specific styling to that tab in the navigation bar.

    Shameless Plug
    Also if your looking for a theme with the navigation bar already present then I’ve developed a theme you might like. Have a look at it. https://themes.wordpress.net/columns/2-columns/3605/techozoic-10/

    Thread Starter modelreject

    (@modelreject)

    Very nice Jeremy.

    The thing is, I will want the blog page to not be the front page. That is where everything is messing up. I could hard code the nav bar into the header template but that kinda defeats the purpose of a content managemeent system.

    Will try out your nice theme now.

    best,
    C

    The code wont make a difference what the home page is set to. All the code does it sees which page is the current page and then highlights that page in the nav bar. You can even take this code out if you don’t want a link to the home page.
    <li class="<?php if (is_home()) echo'current_page_item' ?>"><a href="<?php bloginfo('url'); ?>" title="Home">Home</a></li>

    Thanks for having a look at my theme.

    I, too, am having troubles of this sort.
    https://preview.tinyurl.com/3dexba <== is what I’ve got.
    The home page is static and the posts page is named Posts and its slug is posts. And I would like the posts page tab to light up when the posts page is selected. Reasonable?

    I have read the above posts and I have also read https://codex.www.ads-software.com/Pages#Using_a_Page_as_the_Front_Page_.28version_2.1.2B_only.29

    But I can’t seem to make sense of it. Adding is_page(posts) to the line in my header.php file in the menu ul that looks like this: <li class=”<?php if ( is_page(posts) or is_home() or is_archive() or is_single() or is_paged() or is_search() or (function_exists(‘is_tag’) and is_tag()) ) { ?>current_page_item<?php } else { ?>page_item<?php } ?>”>/” title=”<?php echo get_option(‘k2blogornoblog’); ?>”><?php echo get_option(‘k2blogornoblog’); ?>
    …doesn’t help at all.

    Is that not where it should go?

    Ah, I see this conversation is taking place over here: https://www.ads-software.com/support/topic/107583/page/2?replies=43

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Blog link not highlighting’ is closed to new replies.