different sidebar in each page template ?

Home Forums Using Thematic Child Themes Build Your Own Custom Child Themes different sidebar in each page template ?

This topic is: not resolved

This topic contains 18 replies, has 2 voices, and was last updated by  rashanoureldin 4 years, 12 months ago.

Viewing 15 posts - 1 through 15 (of 19 total)
  • Author
    Posts
  • #1513

    rashanoureldin
    Participant

    Hi , can you please help me in this issue , how i can load different sidebar for each page template i created ??

    Thanks

    #1517

    helgatheviking
    Moderator

    create more widget areas and define each one to only display on a particular page template.

    in page template, change get_sidebar() to

    get_sidebar(‘special_template’)

     

    #1529

    rashanoureldin
    Participant

    any tutorial that can help me do that ????

    Thanks

    #1531

    rashanoureldin
    Participant

    I tried this tutorial but never work

    http://themeshaper.com/2009/12/20/registering-new-sidebars-for-custom-page-templates-the-smart-way/

    any other way i can use please ?

    Thanks

    #1532

    helgatheviking
    Moderator

    any regular wordpress tutorial on registering a new sidebar will work.  but here is the thematic way

    http://themeshaper.com/forums/topic/something-new-bout-widgetized-areas#post-6660

    #1537

    rashanoureldin
    Participant

    Ok thanks but sidebar is not working on the template i use , is it not working on archive.php ?

    #1539

    helgatheviking
    Moderator

    huh?  sidebar works just fine.

    thematic_sidebar();

    you probably need to create a child archive.php template and use get_sidebar() to get your new custom sidebar

     

    #1542

    rashanoureldin
    Participant
    
    <?php
    /**
    * Template Name: MEDIT
    *
    * …
    *
    * @package Thematic
    * @subpackage Templates
    */
    
    // calling the header.php
    get_header();
    
    // action hook for placing content above #container
    thematic_abovecontainer();
    ?>
    
    <div id=”container”>
    
    <?php
    // action hook for placing content above #content
    thematic_abovecontent();
    
    // filter for manipulating the element that wraps the content
    echo apply_filters( ‘thematic_open_id_content’, ‘<div id=”content”>’ . “\n” );
    ?>
    
    <?php
    $term_slug = get_query_var( ‘term’ );
    $taxonomyName = get_query_var( ‘taxonomy’ );
    $current_term = get_term_by( ‘slug’, $term_slug, $taxonomyName );
    $args = array( ‘child_of’ => $current_term->term_id, ‘hide_empty’=>false);
    $terms = get_terms( ‘tagportifolio’, $args);
    $assoc = taxonomy_image_plugin_get_associations();
    
    if (!empty($terms)):
    ?>
    
    <?php foreach( $terms as $child ): ?>
    <?php thematic_abovepost(); ?>
    <div id=”cat-<?php echo $child->term_id; ?>”>
    <?php
    if(array_key_exists( $child->term_taxonomy_id, $assoc )){
    echo wp_get_attachment_image( $assoc[$child->term_taxonomy_id], array(), false, ‘thumbnail’);
    }
    ?>
    
    <h1><a href=”<?php echo get_term_link( $child->name, $taxonomyName );?>”>
    <?php echo $child->name; ?></a ></h1><br/>
    </div>
    
    <?php thematic_belowpost();?>
    
    <?php endforeach; ?>
    
    <?php
    else:
    // start the loop
    ?>
    
    <?php
    
    // displays the page title
    thematic_page_title();
    
    // create the navigation above the content
    thematic_navigation_above();
    
    // action hook for placing content above the category loop
    thematic_above_categoryloop();
    
    // action hook creating the category loop
    thematic_categoryloop();
    
    // action hook for placing content below the category loop
    thematic_below_categoryloop();
    
    // create the navigation below the content
    thematic_navigation_below();
    ?>
    
    <!–</div> #content –>
    
    <?php endif;
    ?>
    <?php
    // action hook for placing content below #content
    thematic_belowcontent();
    ?>
    </div><!– #container –>
    
    <?php
    // action hook for placing content below #container
    thematic_belowcontainer();
    
    // calling the standard sidebar
    thematic_sidebar();
    
    // calling footer.php
    get_footer();
    ?>
    
    

    THIS IS MY PAGE , I NEED TO KNOW WHAT IS MISSING 🙁

    #1543

    rashanoureldin
    Participant

    i dont use custom sidebar now i just need to make thematic sidebar work

    #1545

    rashanoureldin
    Participant

    its working now Thanks

    #1547

    helgatheviking
    Moderator

    switch thematic_sidebar() to get_sidebar(‘custom-sidebar-name’)

    also, it’d be nice for future people to post what you did.  suddenly saying “it works” doesn’t help anybody who might come later with the same question.

    #1552

    rashanoureldin
    Participant

    actually i did nothing major , just i used other template

    &lt;?php
    /**
    * Template Name: Taxonomyarchive
    *
    * Displays an Archive index of post-type items. Other more specific archive templates
    * may override the display of this template for example the category.php.
    *
    * @package Thematic
    * @subpackage Templates
    *
    * @link <a href="http://codex.wordpress.org/Template_Hierarchy" rel="nofollow">http://codex.wordpress.org/Template_Hierarchy</a> Codex: Template Hierarchy
    */
    
    // calling the header.php
    get_header();
    
    // action hook for placing content above #container
    thematic_abovecontainer();
    ?&gt;
    
    &lt;div id=&#8221;taxonomy_container&#8221;&gt;
    
    &lt;?php
    // action hook for placing content above #content
    thematic_abovecontent();
    
    // filter for manipulating the element that wraps the content
    echo apply_filters( &#8216;thematic_open_id_content&#8217;, &#8216;&lt;div id=&#8221;taxonomy_content&#8221;&gt;&#8217; . &#8220;\n\n&#8221; );
    $term_slug = get_query_var( &#8216;term&#8217; );
    $taxonomyName = get_query_var( &#8216;taxonomy&#8217; );
    $current_term = get_term_by( &#8216;slug&#8217;, $term_slug, $taxonomyName );
    $args = array( &#8216;child_of&#8217; =&gt; $current_term-&gt;term_id, &#8216;hide_empty&#8217;=&gt;false);
    $terms = get_terms( &#8216;tagportifolio&#8217;, $args);
    $assoc = taxonomy_image_plugin_get_associations();
    
    if (!empty($terms)):
    foreach( $terms as $child ):
    ?&gt;
    &lt;div id=&#8221;cat-&lt;?php echo $child-&gt;term_id; ?&gt;&#8221;&gt;
    &lt;div&gt;
    
    &lt;?php
    if(array_key_exists( $child-&gt;term_taxonomy_id, $assoc )){
    echo wp_get_attachment_image( $assoc[$child-&gt;term_taxonomy_id], array(), false, &#8216;thumbnail&#8217;);
    }
    ?&gt;
    
    
    &lt;h1&gt;&lt;a href=&#8221;&lt;?php echo get_term_link( $child-&gt;name, $taxonomyName );?&gt;&#8221;&gt;
    &lt;?php echo $child-&gt;name; ?&gt;&lt;/a &gt;&lt;/h1&gt;
    &lt;/div&gt;
    &lt;/div&gt;
    &lt;?php endforeach; ?&gt;
    
    &lt;?php
    else:
    // start the loop
    ?&gt;
    
    &lt;?php
    
    // displays the page title
    //thematic_page_title();
    
    // create the navigation above the content
    //thematic_navigation_above();
    
    // action hook for placing content above the category loop
    //thematic_above_categoryloop();
    
    // action hook creating the category loop
    thematic_categoryloop();
    
    // action hook for placing content below the category loop
    thematic_below_categoryloop();
    
    // create the navigation below the content
    //thematic_navigation_below();
    ?&gt;
    
    &lt;!&#8211;&lt;/div&gt; #content &#8211;&gt;
    
    &lt;?php endif;
    ?&gt;
    &lt;?php
    // action hook for placing content below #content
    thematic_belowcontent();
    ?&gt;
    
    &lt;/div&gt;&lt;!&#8211; #content &#8211;&gt;
    
    &lt;?php
    // action hook for placing content below #content
    thematic_belowcontent();
    ?&gt;
    
    &lt;/div&gt;&lt;!&#8211; #container &#8211;&gt;
    
    &lt;?php
    // action hook for placing content below #container
    thematic_belowcontainer();
    
    // calling the standard sidebar
    thematic_sidebar();
    
    // calling footer.php
    get_footer();
    ?&gt;
    #1553

    helgatheviking
    Moderator

    but you are still calling thematic_sidebar()?  so what’s different?

    #1554

    rashanoureldin
    Participant

    nothing , thats what i dont know why 🙂

    #1555

    helgatheviking
    Moderator

    curious.

Viewing 15 posts - 1 through 15 (of 19 total)

The topic ‘different sidebar in each page template ?’ is closed to new replies.