WordPress.org

Ready to get started?Download WordPress

Forums

different sidebar for custom taxonomies (4 posts)

  1. susno
    Member
    Posted 4 years ago #

    I want to have different sidebar for custom taxonomies. I already create sidebar.php and use conditional tags

    my sidebar.php :

    <?php
    if (is_tax()) {include (TEMPLATEPATH . '/sidebar-tax.php');
    }
    else { include (TEMPLATEPATH . '/sidebar-default.php');
    }
    ?>

    but it's not working. when i go to http://website/?mytaxonomy=test its still go with sidebar-default.php

    in my sidebar-default.php i used dynamic_sidebar
    <?php /* WordPress Widget Support */ if (function_exists('dynamic_sidebar') and dynamic_sidebar(1)) { } else { ?>

    also in my sidebar-tax.php
    <?php /* WordPress Widget Support */ if (function_exists('dynamic_sidebar') and dynamic_sidebar('Taxonomy Sidebar')) { } else { ?>

    Please help me to fixed the problems.. thanks!

  2. susno
    Member
    Posted 4 years ago #

    I guess the problem is with the conditional tags..

    i already tried is_tax, is_taxonomy, is_term but no one is working.. anyone knows how to resolve it?

  3. esmi
    Forum Moderator
    Posted 4 years ago #

  4. m7csat
    Member
    Posted 4 years ago #

    Sidebar.php only works on existing side bars that you register in your theme's function file. Problem is that you register your custom post types in the same place. I'm trying to figure out how to register the custom post types first and then register the sidebars. That is the only way it will work.

Topic Closed

This topic has been closed to new replies.

About this Topic