url for home nav button wrong sometimes, get_bloginfo
-
I have a workaround for this problem but I would like to understand it. I’m using the azul theme, somewhat modified, and I only have a blog, about page, sub page (not on nav), and only three categories which I do like to show on the nav. The code below works, but…
<!-- <?php wp_page_menu('show_home=Blog'); ?> --> <ul> <!-- <li <?php if(is_home()){echo 'class="current_page_item"';}?>><a href="<?php get_bloginfo('url'); ?>">Blog</a></li> --> <li <?php if(is_home()){echo 'class="current_page_item"';}?>><a href="https://marlacorinne.4parkers.com">Blog</a></li> <?php wp_list_pages('title_li=&depth=1'); ?> <?php wp_list_categories('title_li=&depth=0'); ?> </ul>
you can see that I have hard-coded the url for my blog. The line before produces a nav bar that looks identical on all the pages, but the url for the first button, Blog (home), is only correct if you are in fact on that page. It is the url of the current page, whatever that page might be.
I’ve tried get_bloginfo(‘url’) and ‘wpurl’ with the same results, and also get_option(‘home’). All with the same problem.
Can someone explain why? and do I need to finally go read about The Loop now? I’ve gotten this far without it, but I do plan to read it eventually…
thx
- The topic ‘url for home nav button wrong sometimes, get_bloginfo’ is closed to new replies.