ThemeShaper Forums » Thematic

filter syntax question

(3 posts)
  • Started 4 years ago by n8w
  • Latest reply from n8w
  • This topic is resolved

Tags:

  1. n8w
    Member

    I have simple syntax question

    If I want to add a custom filter to my child theme functions.php

    QUESTION: If the post is a page I want it to this .. otherwise I want it to display the standard sidebar?
    I thought it would be something like this .. but how to I call the standard thematic sidebar?

    <?php
    function test() {
    global $post;
    if (is_page()) { ?>
    i am a page
    <?php }else{
    thematic_sidebar();
    }
    }

    add_filter ('thematic_sidebar', 'test');

    ?>

    Posted 4 years ago #
  2. n8w
    Member

    anyone?

    Posted 4 years ago #
  3. n8w
    Member

    Looks like this solved it

    // side bar
    function my_custom_sidebar() {
    global $post;
    if (is_page('Contact')) { ?>
    <div id="primary" class="aside main-aside">
    <ul class="xoxo">
    Contact sidebar

    </div><!-- #primary .aside -->

    <? } elseif (is_page('About')){ ?>
    <div id="primary" class="aside main-aside">
    <ul class="xoxo">
    About sidebar

    </div><!-- #primary .aside -->
    <? }else{ ?>
    <div id="primary" class="aside main-aside">
    <ul class="xoxo">
    <? dynamic_sidebar('primary-aside'); ?>

    </div><!-- #primary .aside -->

    <?}
    }

    add_filter ('thematic_sidebar', 'my_custom_sidebar');

    Posted 4 years ago #

RSS feed for this topic

Reply

You must log in to post.