The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

insert wp_list_pages in the pages without using exe-php (is there another way) (4 posts)

  1. jbencic
    Posted 8 years ago #

    i am trying to create a page which lists links for its sub-pages.

    currently i have created a new "pages" template and added the following code below. this all works fine

    i was wondering if it is possible to call the "wp_list_pages" function without having to use something like the exe-php plugins?
    this way i wouldn't have to create a new template.

    <?php if($post->post_parent) { // page is a child
    	echo "<ul>";
    	echo "</ul>";
    if(wp_list_pages("child_of=".$post->ID."&echo=0")) { // page has children
    	echo "<ul>";
    	echo "</ul>";
    } ?>
  2. Adam Brown
    Posted 8 years ago #

    So you've found the first two options: exe-php and a page template. The third option would be to create a new plugin to do this, but I'm not sure that would be easier than the page template solution.

    Check out the Plugin API though if that's your thing. Hook into the "the_content" hook if is_page().

  3. jbencic
    Posted 8 years ago #

    sounds like the API choice is the way to go


  4. dlo
    Posted 8 years ago #

    I wrote a plugin that can be useful for that.
    You can even choose to display part of the text in addition to the title.
    You can find it there.

    Best regards

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.