Title: modifying wp_list_pages() to use image for title
Last modified: August 19, 2016

---

# modifying wp_list_pages() to use image for title

 *  Resolved [paxnwo](https://wordpress.org/support/users/paxnwo/)
 * (@paxnwo)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/modifying-php-wp_list_pages/)
 * this function : `wp_list_pages();` lists my pages in this format :
 *     ```
       Pages
       page1
       page2
       page3
       ```
   
 * Well , i dont want it to show me the word “**Pages**“. Instead of “**Pages**”
   i want to add an **image**.
 *     ```
       Image
       page1
       page2
       page3
       ```
   
 * I dont know where to edit. I selected the sidebar.php from the editor and there
   i have `<?php wp_list_pages(); ?>` but i cannot edit it from there. I want to
   get rid of “Pages” and use `<img src="image.gif">` istead. I think i must edit
   some other files to make this possible.
 * My screenshot explains the problem. I added an image for Categories, one for 
   Search and one for Archive, but i cannot add an image to Pages.
 * [http://img386.imageshack.us/img386/402/57980632qn0.jpg](http://img386.imageshack.us/img386/402/57980632qn0.jpg)
 * **Can you help** ? _Thanks_.

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Shari](https://wordpress.org/support/users/shari/)
 * (@shari)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/modifying-php-wp_list_pages/#post-954663)
 * Did you already edit the sidebar.php file to add those other images in there?
 * The word “Pages” in your screenshot should be just above the `<?php wp_list_pages();?
   >` in the sidebar.php. Is it not there?
 * Can you post the sidebar.php file or give me the URL to it so I can look at it?
 *  Thread Starter [paxnwo](https://wordpress.org/support/users/paxnwo/)
 * (@paxnwo)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/modifying-php-wp_list_pages/#post-954733)
 * well , the word “Pages” isnt there.
 * This is the sidebar.php from the theme.
 *     ```
       <!-- begin sidebar -->
       <div id="menu">
   
       <ul>
       <?php if ( !function_exists('dynamic_sidebar')
               || !dynamic_sidebar() ) : ?>
   
       <?php wp_list_pages(); ?>
   
        <li id="categories"><img src="http://www.voievozii.ro/categorii.gif">
       	<ul>
       	<?php wp_list_cats(); ?>
       	</ul>
        </li>
        <li id="search">
          <label for="s"><img src="http://www.voievozii.ro/cauta.gif"></label>
          <form id="searchform" method="get" action="<?php echo $_SERVER['PHP_SELF']; ?>">
       	<div>
       		<input type="text" name="s" id="s" size="15" /><br />
       		<input type="submit" value="<?php _e('Cauta !'); ?>" />
       	</div>
       	</form>
        </li>
        <li id="archives"><img src="http://www.voievozii.ro/arhiva.gif">
        	<ul>
       	 <?php wp_get_archives('type=monthly'); ?>
        	</ul>
        </li>
   
       <?php endif; ?>
       </ul>
   
       </div>
       <!-- end sidebar -->
       ```
   
 *  [roya khosravi](https://wordpress.org/support/users/roya-khosravi/)
 * (@roya-khosravi)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/modifying-php-wp_list_pages/#post-954739)
 * To add an image at the top of your page listing:
    <?php wp_list_pages(‘title_li
   =’. __(‘<img src=”image.gif”>’)); ?>
 * To use a random image :
    <?php $tab = array( ‘<img src=”image1.gif”>’, ‘<img 
   src=”image2.gif”>’, ‘<img src=”image3.gif”>’); wp_list_pages(‘title_li=’. __(
   $tab[rand(0,2)])); ?>
 *  Thread Starter [paxnwo](https://wordpress.org/support/users/paxnwo/)
 * (@paxnwo)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/modifying-php-wp_list_pages/#post-954748)
 * thanks a lot man. i apreciate.
 *  [roya khosravi](https://wordpress.org/support/users/roya-khosravi/)
 * (@roya-khosravi)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/modifying-php-wp_list_pages/#post-954750)
 * Woman! arghhh!
 *  [kevingoldman](https://wordpress.org/support/users/kevingoldman/)
 * (@kevingoldman)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/modifying-php-wp_list_pages/#post-955143)
 * Thanks Roya!
 * One more quick question – what if I wanted the image name to be a meta_value 
   for each post instead of a hard coded image name?
 * Thanks in advance?

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘modifying wp_list_pages() to use image for title’ is closed to new replies.

## Tags

 * [list](https://wordpress.org/support/topic-tag/list/)
 * [Modify](https://wordpress.org/support/topic-tag/modify/)
 * [pages](https://wordpress.org/support/topic-tag/pages/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [wp_list_pages](https://wordpress.org/support/topic-tag/wp_list_pages/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 4 participants
 * Last reply from: [kevingoldman](https://wordpress.org/support/users/kevingoldman/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/modifying-php-wp_list_pages/#post-955143)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
