This topic has 3 replies, 2 voices, and was last updated 8 years by Radu.

  • Author
  • #92619
     carlostinca
    Participant

    Hi,

    We have two post types with his respective taxonomies in them. Each one have a taxonomy and post archive page, but we want to replace the Main Sidebar associated to that page (we used the archive template of Kleo) for one that we created.

    How we can do this?

    Thanks,

    Carlos

    (sorry about my english)

    #92668
     Radu
    Moderator

    Hi,

    Add this snippet to your wp-content/theme/kleo-child/functions.php

    COPY CODE
    
    
    
    function add_before_my_siderbar() { ?>
       
    < ?php
    if (is_archive()) { ?>
    <div class="sidebar sidebar-main col-sm-3 sidebar-3rr">
    	<div class="inner-content widgets-container">
     
    		< ?php dynamic_sidebar('for home'); ?>
     
    	</div><!--end inner-content-->
    </div><!--end sidebar-->
    < ?php } ?>
     
     
    < ?php
    }
    add_action( 'get_sidebar', 'add_before_my_siderbar' );
    
    function add_before_my_siderbar() { ?>
       
    < ?php
    if (is_archive()) { ?>
    <div class="sidebar sidebar-main col-sm-3 sidebar-right">
    	<div class="inner-content widgets-container">
     
    		< ?php dynamic_sidebar('For Custom Taxonomy'); ?>
     
    	</div><!--end inner-content-->
    </div><!--end sidebar-->
    < ?php } ?>
     
     
    < ?php
    }
    add_action( 'get_sidebar', 'add_before_my_siderbar' );
    

    Cheers

    RAdu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
    #92722
     carlostinca
    Participant

    I getting an error of unexpected end of file, even fixing the extra space and things. Is there any error on the code that im not seeing?

    Also, how can i assing a custom sidebar for a custom taxonomy or post archive?, because there is only about custom taxonomy. Just to make it clear:

    HotelArchiveSidebar -> HOtel Post Archive and Hotel Category Taxonomy.
    Activities -> Activities Post Archive and Activities Category Taxonomy.

    Thanks,
    Carlos

    #93150
     Radu
    Moderator

    In this case i suggest you to look at this plugin it seems that its ok for what you need.

    https://wordpress.org/plugins/content-aware-sidebars/

    Cheers

    Radu

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution
Viewing 4 posts - 1 through 4 (of 4 total)

The forum ‘General questions’ is closed to new topics and replies.

Log in with your credentials

Forgot your details?