sidebar isn’t showing, what’s wrong w/ this code?

Here’s what I have in my sidebar.php:

  <aside id="sidebar">
    <?php if ( is_user_logged_in() ) {
      echo '<a href="https://wordpress.stackexchange.com/community"><img id="visit-the-forums" src="'. bloginfo('template_url') . '/images/visit-the-forums.png" alt="Check out the Forums!" /></a>'
    } else {
      echo '<a href="https://wordpress.stackexchange.com/community"><img id="join-the-forums" src="'. bloginfo('template_url') . '/images/join-the-forums.png" alt="Join the Forums!" /></a>'
    }
    ?>
    <a id="side-ad">
      <img src="<?php bloginfo('template_url') ?>/images/ipad-ad.png" alt="iPad 2 Giveaway!" />
    </a>
  </aside>

For some reason, it doesn’t show (not even in the markup) for any of the pages. I’ve double-checked all of the other templates to make sure <?php get_sidebar(); ?> is included. Is there something wrong w/ the code above?

Edit: I should note that the below works, that is, without the if/else statement.

  <aside id="sidebar">
    <a href="https://wordpress.stackexchange.com/community"><img id="join-the-forums" src="<?php bloginfo('template_url') ?>/images/join-the-forums.png" alt="Join the Forums!" /></a>
    <a id="side-ad">
      <img src="<?php bloginfo('template_url') ?>/images/ipad-ad.png" alt="iPad 2 Giveaway!" />
    </a>
  </aside>

2 Answers
2

Does the markup after <?php get_sidebar(); ?> show up?

I would guess that this is a silent PHP error, as your lines within the if/else block do not end with semi-colons. 🙂

Leave a Comment