WordPress.org

Ready to get started?Download WordPress

Forums

images in the wp_list_pages function? (4 posts)

  1. moody
    Member
    Posted 8 years ago #

    There is so much information here, I need some help trying to find the right bits.

    I'm trying to get the image that is associated with a Page to appear in the HTML of the navigation list that is created with the wp_list_pages function.

    Right now I'm using the wp_list_pages on a parent page to list the children/subpages of it. Like this:
    <ul>
    <?php wp_list_pages('title_li=&child_of=5&sort_column=menu_order'); ?>
    </ul>

    Which returns this:

    <ul>
    <li class="page_item"><a href="Permalink-1" title="Page Title 1">My 1 Page Title</a></li>
    <li class="page_item"><a href="Permalink-2" title="Page Title 2">My 2 Page Title</a></li>
    <li class="page_item"><a href="Permalink-3" title="Page Title 3">My 3 Page Title</a></li>
    </ul>

    But what I'd like it to return is this:

    <ul>
    <li class="page_item"><a href="Permalink-1" title="Page Title 1">My 1 Page Title<span><img src="/image/associated/to/Page-1.jpg" width="350" height="246" alt="Page Title 1"></span></a></li>
    <li class="page_item"><a href="Permalink-2" title="Page Title 2">My 2 Page Title<span><img src="/image/associated/to/Page-2.jpg" width="350" height="246" alt="Page Title 2"></span></a></li>
    <li class="page_item"><a href="Permalink-3" title="Page Title 3">My 3 Page Title<span><img src="/image/associated/to/Page-3.jpg" width="350" height="246" alt="Page Title 3"></span></a></li>
    </ul>

    I'm looking at all the plugins and can't figure out if any of them will do this. I'm looking at Kafkaesqui's post image plugin that is talked about here.

    Anyone have any ideas? Am I barking up the right tree?

    Thanks for thinking about it!

  2. Gianko
    Member
    Posted 8 years ago #

    Do you solve this problem yet???
    i needing something like this.

  3. mbeihoffer
    Member
    Posted 7 years ago #

    I, too, am in need of something of this nature. Ideally, there would be a way to associate an image with a Page, and an additional parameter would be added to the wp_list_pages function.

    That way, you could call the wp_list_pages function, and it would generate a series of thumbnail images, one for each page, and each one would be linked to the page it is associated with.

    As I have recently written a similar plugin, I may attempt to write a simple plugin for this - check out http://beta.dragonfly-networks.com - I will post the plugin there when it's done.

  4. StaceyUD
    Member
    Posted 7 years ago #

    I need this too, anyone got this figured out yet?

Topic Closed

This topic has been closed to new replies.

About this Topic