Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #912122
    Karolina N
    Participant

    Hi! I am trying to set two specific sidebars to show up on single posts.

    One for the blog wich will show the main sidebar and one for a new post-type that I have put in

    I’m doing this in a child-theme and I’m working on single.php for the stack that I’m using.

    But this does nothing on my page?

    <?php if ( $fullwidth != ‘on’ ) : ?>
    <?php get_sidebar(‘ups-sidebar-tidigare-tavlingar’); ?>
    <?php endif; ?>

    I will work around the if statement later. Right now I’m just trying to get the right sidebar to get read.

    Can you help me? 🙂

    #912154
    Karolina N
    Participant

    So I figured out that I need to use dynamic sidebars but to the if else statement I can not get futher..

    <?php
    if ( $fullwidth != ‘on’ ) :
    dynamic_sidebar(‘ups-sidebar-tidigare-tavlingar’);
    elseif (is_blog ()) :
    get_sidebar();
    else :
    get_sidebar();
    endif;
    ?>

    I’m trying to set an && after $fullwidth != ‘on’ but I get errors doing that so what could I type in instead?

    #912313
    Karolina N
    Participant

    Sorry I solved it. 🙂

    Did this:

    In single.php

    <?php
    if (is_blog ()) :
    get_sidebar();
    else : ?>
    <aside class=”x-sidebar right” role=”complementary”> <?php dynamic_sidebar(‘ups-sidebar-tidigare-tavlingar’); ?> </aside> <?php
    endif;
    ?>

    in functions.php
    function is_blog () {
    return ( is_archive() || is_author() || is_category() || is_home() || is_single() || is_tag()) && ‘post’ == get_post_type();
    }

    #912337
    Thai
    Moderator

    Glad you’ve sorted it out.

    If you need anything else, please let us know 🙂

  • <script> jQuery(function($){ $("#no-reply-912122 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>