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.
This website uses cookies

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information that you’ve provided to them or that they’ve collected from your use of their services.

Cookies are small text files that can be used by websites to make a user's experience more efficient.

The law states that we can store cookies on your device if they are strictly necessary for the operation of this site. For all other types of cookies we need your permission. This means that cookies which are categorized as necessary, are processed based on GDPR Art. 6 (1) (f). All other cookies, meaning those from the categories preferences and marketing, are processed based on GDPR Art. 6 (1) (a) GDPR.

This site uses different types of cookies. Some cookies are placed by third party services that appear on our pages.

You can at any time change or withdraw your consent from the Cookie Declaration on our website.

Learn more about who we are, how you can contact us and how we process personal data in our Privacy Policy.

Please state your consent ID and date when you contact us regarding your consent.