ThemeShaper Forums » Thematic


Sidebar page menu

(4 posts)
  • Started 4 years ago by flake
  • Latest reply from flake
  • This topic is resolved
  1. flake


    I am attempting to add a sidebar menu to Thematic to list child pages. I am still learning the code, but this is what I have so far

    function childtheme_sidemenu() {
        global $post; 
        if (is_page()) { ?>
           <?php if($post->post_parent)
                $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->post_parent."&echo=0"); else
                $children = wp_list_pages("sort_column=menu_order&title_li=&child_of=".$post->ID."&echo=0");
                    if ($children) { ?>
                <h2><?php echo $page_name; ?> Sections</h2>
                <?php echo $children; ?>
                <div class=sidebar-spacer></div>
            <?php } ?> 
        <?php } 
    add_filter( 'thematic_abovemainasides()', 'childtheme_sidemenu' );

    This is generating a syntax error related to a }.

    I would appreciate any suggestions, or pointers to relevant guides.


    Posted 4 years ago #
  2. flake

    ok, after much head scratching I have found the issue causing the syntax error. Two issues actually.

    1. due to cutting and pasting, two final php brackets had crept into the code ?>
    2. There was a space and blank line after the final ?> which apparently causes problems.

    Despite fixing the syntax error, the menu is not appearing in the sidebar. I'm still learning how all this works, and expect I've made a fundamental mistake.

    I would really appreciate some pointers.


    Posted 4 years ago #
  3. thematic_abovemainasides() is a hook and not a filter. So, use the following code instead:

    add_action('thematic_abovemainasides', 'childtheme_sidemenu');

    Artur Kim

    Posted 4 years ago #
  4. flake

    thanks arturkim, that did the trick

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.