WordPress.org

Forums

Page-list
[resolved] Execute [subpages] on every page that contains subpages (5 posts)

  1. Pepozzo
    Member
    Posted 2 years ago #

    Is it possible to automatically insert [subpages] tag on every pages that have subpages?

    Thanks,
    Stefano

    http://wordpress.org/extend/plugins/page-list/

  2. webvitaly
    Member
    Plugin Author

    Posted 2 years ago #

    It is impossible to make with the plugin.

    I would recommend to modify theme files.
    You should check if current page has subpages and in that case you should show that subpage.

  3. Pepozzo
    Member
    Posted 2 years ago #

    Thanks!

    So, i have to modify theme code and it's impossible to make a code call to the plugin from the theme page, right? (this could be a stupid question)

  4. webvitaly
    Member
    Plugin Author

    Posted 2 years ago #

    You should add to template something like this:

    <?php
    $children = get_pages('child_of='.$post->ID);
    if( count( $children ) != 0 ) {
    	echo do_shortcode('[subpages]');
    } else {
    	// no subpages
    }
    ?>
  5. Pepozzo
    Member
    Posted 2 years ago #

    That works perfectly!

    Thank you so much!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Page-list
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.