Title: sidebar image/link issues
Last modified: August 18, 2016

---

# sidebar image/link issues

 *  [Doodlebee](https://wordpress.org/support/users/doodlebee/)
 * (@doodlebee)
 * [19 years, 7 months ago](https://wordpress.org/support/topic/sidebar-imagelink-issues/)
 * Sorry for the not-very-descriptive title, but I couldn’t think of a title to 
   actually describe the issue without making it 20 words long – so I opted for 
   that!
 * Anyway, I’m trying to customize my sidebar.php file. What I need to do is have
   a link to a Page that has an image next to the link when you’re on the Page associated
   with that link. (Criminy, that’s a mouthful!) This isn’t a problem – I can easily
   do this – the problem comes into the index page. I need to have *all* Page links
   on the index to have the graphic next to it.
 * For purposes of visualization, if you are on the “About Us” Page, then the menu
   should look like so (the * representing the graphic):
 * *About Us
    Resources Contact
 * But if you’re on the index page, the menu should look like so:
 * *About Us
    *Resources *Contact
 * My problem is that, to get the graphic to display on all the links on the index
   page, I need to apply the `if (is_home()) {` to the PHP. Which works great – 
   however, because all of the pages come from the index (in other words, the Page
   URL is “index.php?page_id=2”) it seems to think that *all* of the pages are still
   on the home page, and therefore, on *all* Pages, *all* of the links have the 
   graphic next to them.
 * I hope this is making sense to you. I *so* want to share the link with you so
   you can actually see it, but I can’t – I’m under an NDA for this site until it’s
   released. (I could pass along a link privately via email though…so if anyone 
   is generous enough to try that one, email shelly AT candybill DOT com) Hopefully
   showing you a bitty piece of the code will help you see the back end of things:
 * `<li id="services" <a href="<?php echo get_permalink(10); ?>">
    <?php if (is_home
   || is_page('10')) { ?> <img src="<?php bloginfo('template_directory'); ?>/images/
   services_off.gif" width="128" height="16" alt="Services" /> <?php } else { ?>
   <img src="<?php bloginfo('template_directory'); ?>/images/services_inside_off.
   gif" width="128" height="16" alt="Services" /> <?php } ?></a> </li>
 * Now, I’ve thought of swapping it around, so that the “inside_off” version is 
   the default (that’s the one with *no* graphic on the side), but when I do that,
   it seems the only way I can get the side graphic to show is to add *every single
   Page* to the PHP code in one of the calls up there. That will not do – because
   if they ever add any more Pages, then it’ll screw up the sidebar. (Make sense?)
 * Maybe I just need a fresh set of eyes to look at this – I’m starting to think
   I’m overthinking this and/or have been looking at it for too long. But if someone
   could give me a suggestion, I’d really appreciate it.
 * Thanks!

The topic ‘sidebar image/link issues’ is closed to new replies.

## Tags

 * [custom](https://wordpress.org/support/topic-tag/custom/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [Doodlebee](https://wordpress.org/support/users/doodlebee/)
 * Last activity: [19 years, 7 months ago](https://wordpress.org/support/topic/sidebar-imagelink-issues/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
