Created
May 18, 2009 17:07
-
-
Save szbl/113615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: List Children | |
Plugin Author: Andy Stratton | |
Plugin URI: http://theandystratton.com | |
Author URI: http://[email protected] | |
Version: 1.0 | |
Description: Use an HTML comment (<code><!--list_children()--></code>) in post content to call wp_list_pages for sub-pages of the current page. | |
*/ | |
function lc_list_pages( $sort_column = 'menu_order', $sort_order = 'ASC' ) { | |
return wp_list_pages('echo=0&title_li=&child_of=' . get_the_ID() . "&sort_column=$sort_column&sort_order=$sort_order"); | |
} | |
function lc_list_pages_content( $content ) { | |
$comment = '<!--list_children()-->'; | |
$content = str_replace($comment, lc_list_pages(), $content); | |
return $content; | |
} | |
add_filter('the_content', 'lc_list_pages_content'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment