• I added a “home” link to my sidebar and it shows up properly on the blog’s main page and archives and categories pages.

    I also added a graphic/text ad and a “add to Yahoo” button. But these only show up on the main page and not any of the subpages. They are all on the sidebar template.

    Why is one change showing up everywhere (as intended) and the others only on main page? And, of course, how can I fix this.

Viewing 7 replies - 1 through 7 (of 7 total)
  • WordPress has conditional statements like ‘is_home’ (are we viewing the home page?) or is_single (are we viewing a single entry?). In most templates the sidebar is full of conditionals like this. I suspect you put your ‘home’ and ‘yahoo’ links under different conditionals.

    Thread Starter boogiewoogie

    (@boogiewoogie)

    I’m sorry, I should have included the link. I didn’t intentionally do anything like that. Here’s the link
    https://www.fishing-trip-advisor.com/blog

    Thanks for the link. It looks like that’s all your problem is so it’s easy to fix. Here’s the code in the default template’s sidebar.php
    (I’ve shortened a few lines).


    <?php /* If this is the frontpage */ if ( is_home() || is_page() ) { ?>
    <?php get_links_list(); ?>

    • <h2>Meta</h2>
      <?php wp_register(); ?>

    • <?php wp_loginout(); ?>
    • ... validate link ...
    • ... xfn link ...
    • ... wordpress link ...
    • ... Yahoo link ...
      <?php wp_meta(); ?>

    <?php } ?>

    You see how the very first line says if ( is_home() || is_page() ) { ?. So that’s saying ‘if we’re viewing the home page or we’re viewing a ‘page’ (ie something you made under write->pages) then show this section. And the section goes from the ‘{‘ at the end of that line to the ‘}’ at the end. Since your Yahoo link is in that section, it will only show on the home page or a ‘page’ you made. It can be a little confusing but it also makes per page customization quite powerful.

    Anyway, the short story? Just move your yahoo link after the last } and it will then show on any page.

    The code got a little messed up there but it’s the last section in your sidebar.php file. Let me know if it’s still not clear.

    Thread Starter boogiewoogie

    (@boogiewoogie)

    Thanks for a great explanation. I’ll keep playing with it… I’m not doing something right. When I move the link after the last } I get a “Parse error: parse error, unexpected ‘<‘ ” error code. And nothing is showing up in the sidebar.

    Thread Starter boogiewoogie

    (@boogiewoogie)

    Thanks Ming. I got it, finally. I actually had to put the info after the “>” which followed the “}”.

    I appreciate your help… don’t know how long it would have taken without it.

    Dave

    Glad you got it figured out, the page looks good.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Sidebar Confusion’ is closed to new replies.