Description
Implements [bw_tree] shortcodeCreate a simple tree of the 'pages' under the selected id We default the ordering to match the menu order of the pages The default tree starts from the current 'post' If post_parent=" " or post_parent=. then we use the current post's parent If you want to include the current post in the tree then add exclude=-1
Usage
bw_tree( $atts );Parameters
- $atts
- ( mixed ) optional –
Returns
voidSource
File name: oik/shortcodes/oik-tree.phpLines:
1 to 23 of 23
function bw_tree( $atts = NULL ) { $atts['orderby'] = bw_array_get($atts, "orderby", "menu_order" ); $atts['order'] = bw_array_get( $atts, "order", "ASC" ); $atts['post_parent'] = bw_array_get( $atts, "post_parent", null ); //bw_trace2( "!{$atts['post_parent']}!", "derr" ); switch ( $atts['post_parent'] ) { case null: $atts['post_parent'] = bw_global_post_id(); break; case " ": case ".": $post = bw_global_post(); if ( $post ) { $atts['post_parent'] = $post->post_parent; } break; default: // Assume it's an integer and carry on. } bw_tree_func( $atts ); return( bw_ret() ); }View on GitHub View on Trac
Called by
1 to 2 of 2
Invoked by
Calls
1 to 5 of 5
- bw_array_get() – Return the array[index] or array->index (for an object) or a default value if not set
- bw_global_post() – Save/restore the global post and id
- bw_global_post_id() – Return the global post ID
- bw_ret() – Use bw_ret() to return the contents of $bwecho, leaving the global value as NULL
- bw_tree_func() – Build and format a tree
