Shortcode for showing childpages

Put this in your theme’s functions.php, it will add the shortcode [child_pages]: function wpsc_child_pages($atts){ global $wp_query; $html=””; if( empty($wp_query->post->post_parent) ) { $parent = $wp_query->post->ID; } else { $parent = $wp_query->post->post_parent; } $pages = wp_list_pages(“title_li=&child_of=$parent&echo=0”); if( $pages ){ $html .= “<div><ul>$pages</ul></div>”; } return $html; } add_shortcode(‘child_pages’, ‘wpsc_child_pages’); If you want to pass the function variables (e.g. … Read more

How to implement theme shortcodes in text outside of pages?

You can run the text through do_shortcode: echo do_shortcode( $your_text_with_shortcodes ); or you can apply the_content filters to the text, which does the same thing as above along with some additional formatting goodies, like auto paragraphs and texturize: echo apply_filters(‘the_content’, $your_text_with_shortcodes);