dynamic sidebar call, depending on top-level page
-
hello
i am attempting to load different dynamic sidebars depending on the top-level page, but am having problems with the syntax.
1. I am using a variable called $sect_title to hold the top-level page name. (see below)
<? $post_ancestors = get_post_ancestors($post); if (count($post_ancestors)) { $top_page = array_pop($post_ancestors); $children = wp_list_pages('title_li=&child_of='.$top_page.'&echo=0'); $sect_title = get_the_title($top_page); } elseif (is_page()) { $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0&depth=2'); $sect_title = the_title('','', false); } ?>
2. I am then attempting to call the sidebar with the code below, but is failing. Not working
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('echo $sect_title') ) { ?> Not working <?php } ?>
when i hardcode to troubleshoot, it pulls in the sidebar fine.
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('home') ) { ?> Not working <?php } ?>
im sure it’s just a syntax issue.
thanks in advance
rhys
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘dynamic sidebar call, depending on top-level page’ is closed to new replies.