WordPress.org

Ready to get started?Download WordPress

Plugin Directory

Child Pages Shortcode

You can use shortcode for display child pages from the page.

You can use shortcode for display child pages from the page.

This plugin maintained on GitHub.

Some features

  • This plugin will add shortcode [child_pages] display child pages.
  • You can customize default HTML template on your plugin.
  • This plugin will be able to "excerpt" to the pages.

Example

Display child pages of the current page.

[child_pages width="33%"]

Args

  • id - ID of page (Optional)
  • size - Post thumbnail size. e.g. 'thumbnail' or 'large'
  • width - width of block for child pages.
  • disable_shortcode - Shortcode not work in the template if set true.
  • disable_excerpt_filters - filters not work for the excerpt if set true.

filter hooks example

Filter for query_posts() query.

<?php
    // default args
    $args = array(
        'post_status' => 'publish',
        'post_type' => 'page',
        'post_parent' => $id_for_the_post,
        'orderby' => 'menu_order',
        'order' => 'ASC',
        'nopaging' => true,
    );

    add_filters('child-pages-shortcode-query', "my_query");
    function my_query($args) {
        //
        // some code here
        //
        return $args;
    }
?>

Filter for default template.

<?php
    add_filter("child-pages-shortcode-template", "my_template");
    function my_template($template) {
        return '<div class="%class%"><a href="%post_url%">%post_thumb%</a></div>';
    }
?>

Filter for stylesheet URI.

<?php
    add_filter("child-pages-shortcode-stylesheet", "my_style");
    function my_style($url) {
        return 'http://example.com/path/to/style.css';
    }
?>

Default Template

<div id="child_page-%post_id%" class="child_page" style="width:%width%;">
    <div class="child_page-container">
        <div class="post_thumb"><a href="%post_url%">%post_thumb%</a></div>
        <div class="post_content">
            <h4><a href="%post_url%">%post_title%</a></h4>
            <div class="post_excerpt">%post_excerpt%</div>
        </div>
    </div>
</div>

Template valiables

  • %post_id% - ID of the Page
  • %width% - Width of block for single page
  • %post_url% - Page permalink
  • %post_thumb% - for Post thubmail
  • %post_title% - Page title
  • %post_excerpt% - Page excerpt

Support

Contributors

Tags:

Requires: 3.4 or higher
Compatible up to: 3.7.1
Last Updated: 2013-10-25
Downloads: 36,173

Ratings

4 stars
4.8 out of 5 stars

Support

0 of 2 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

100,1,1
100,1,1
100,1,1
100,1,1
50,2,1
100,1,1
100,1,1 100,1,1
100,1,1
100,4,4
100,1,1