Sidebars

Hello

if i create taxonomy-term.php, i haven't sidebar.

I use in functions.php :

function build_taxonomies() {
register_taxonomy( 'thematiques', 'post', array( 'hierarchical' => true, 'label' => 'Thématiques', 'query_var' => true, 'rewrite' => true ) );
register_taxonomy( 'federations', 'page', array( 'hierarchical' => true, 'label' => 'Fédérations', 'query_var' => true, 'rewrite' => true ) );
}

I'd like to have a custom sidebar in taxonomy-thematiques.php

How can i do to achieve this ?

Thank you for your help.

Best regards

Comments

  • Hi,

    we don`t know if your php skills are good because this is not easy thing but we`ll try to explain...

    Your file, you mentioned above taxonomy-thematiques.php, should look similar to what we paste below:
    <?php
    /**
    * @package Betheme
    * @author Muffin group
    * @link http://muffingroup.com
    */

    get_header();
    ?>

    <!-- #Content -->
    <div id="Content">
    <div class="content_wrapper clearfix">

    <!-- .sections_group -->
    <div class="sections_group">
    <?php
    while ( have_posts() ){
    the_post();
    the_content();
    }
    ?>
    </div>

    <!-- .four-columns - sidebar -->
    <div class="four columns">
    <div class="widget-area clearfix">
    <?php dynamic_sidebar( 'my-sidebar-name-added-in-theme-options' ); ?>
    </div>
    </div>

    </div>
    </div>

    <?php get_footer(); ?>
    And also what you need to do is go to  functions/theme-head.php and replace below code:
    if( function_exists('is_bbpress') && is_bbpress() && is_active_sidebar( 'forum' ) ){
        $classes = ' with_aside aside_right';
    }
    with:
    if( function_exists('is_bbpress') && is_bbpress() && is_active_sidebar( 'forum' ) ){
        $classes = ' with_aside aside_right';
    }
    if ( is_page_template( 'taxonomy-thematiques.php' ) ) {
        $classes = ' with_aside aside_right';
    }
    But as we wrote above this is not easy thing and you need to study those files and code very well to understand how this works exactly.
  • edited July 2014
    Hello,

    Thank you for your reply.
    I changed the code in functions/theme-head.php and add 
    <!-- .four-columns - sidebar -->
    <div class="four columns">
    <div class="widget-area clearfix">
    <?php dynamic_sidebar( 'accueil' ); ?>
    </div>
    </div>
    in taxonomy-thematiques.php (a copy of index.php).

    The sidebar appears now but below the content not aside. it's still fullwidth.
    "with_aside aside_right" don't appear in the body classes.

    Thank you for your help.

    Regards.






  • Here's the body classes :

    <body class="archive tax-thematiques term-democratie term-6 logged-in admin-bar no-customize-support  color-custom layout-full-width header-stack header-center minimalist-header sticky-header nice-scroll-on">
  • Ok i found :

    if ( is_tax('thematiques') ) {
    $classes = ' with_aside aside_right';
    }

    Thank you for your advices.

    Regards
  • You're welcome! :) We're glad to see that you have sorted it yourself.
Sign In or Register to comment.