Skip to content

matthieubrunet/child-pages-shortcode

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

=== Child Pages Shortcode ===
Contributors: miyauchi - forked by Matthieu Brunet
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=FR7RD5SGEU69Y
Tags: shortcode
Requires at least: 3.4
Tested up to: 3.7
Stable tag: 1.0.0

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

== Description ==

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

[This plugin maintained on GitHub.](https://github.com/miya0001/child-pages-shortcode)

= 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.

The fork add the following features :
* class parameter to specify the main div class
* template_file to specify a particular template file
* new %post_content% replacement tag to display the full content instead of the excerpt
* add the childPages function to be used as the template tag

= Example =

Display child pages of the current page.
`[child_pages width="33%"]`
Template tag :
childPages(array("id"=>3, "size"=>"25%", "width"=>"thumbs", "class"=>"my-child-page-class", "template_file"=>"my_template_file.php");


= 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.
* class - specify the class of the parent div
* template_file - specify a template file located in the theme directory

= 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 variables

* %post_id% - ID of the Page
* %width% - Width of block for single page
* %post_url% - Page permalink
* %post_thumb% - <img> for Post thubmail
* %post_title% - Page title
* %post_excerpt% - Page excerpt
* %post_content% - Page content


= Contributors =

* [Takayuki Miyauchi](http://wpist.me/)
* [Matthieu Brunet](http://www.brunet.fr)

== Installation ==

* A plug-in installation screen is displayed on the WordPress admin panel.
* It installs it in `wp-content/plugins`.
* The plug-in is made effective.

== Changelog ==

1.0.0 first version of the fork

About

Fork of child-pages-shortcode to add several options

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 80.6%
  • CSS 12.9%
  • JavaScript 6.5%