This topic has 9 replies, 2 voices, and was last updated 9 years by knt.

  • Author
  • #70940
     knt
    Participant

    Hello guys!

    I want a custom sidebar for my activity page. How and where should i insert my code?

    Cheers!

    #70959
     sharmstr
    Moderator

    You can try /kleo/sidebar.php. Just put a conditional check before generated_dynamic_sidebar

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70961
     knt
    Participant

    Hi @sharmstr, thanks for helping me again.

    What would be the condition if i want to show my code on the sidebar of the Site Activitiy page with left and right sidebars. For instance i want to show it on the right sidebar. Any thoughts?

    #70964
     sharmstr
    Moderator

    When using 2 sidebars, kleo uses the kleo_extra_sidebar function to display the right sidebar. Copy that function from /kleo/functions.php into your child theme. Do the conditional check there instead of in sidebar.php

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70966
     knt
    Participant

    The kleo_extra_sidebar function is in line 885. I’ve the template that the Site Activity page is using and it is calling for “3lr” which could be found at line 911 in the functions.php. How do you suggest i should do the conditional check?

    By the way i’m not using a child theme because of performance concerns.

    #70968
     sharmstr
    Moderator

    Not using a child theme is a bad idea if you’re going to be customizing.

    I think you are miss understanding. When I say conditional check, I mean, checking to see if you are on the activity page. There’s no need to conditional check the location of the sidebar. Again, the extra sidebar function is all you need to change. That’s the function that renders the right sidebar in a left and right sidebar layout. Just make sure you set left and right sidebar layout in theme options > buddypress > activity page layout.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70972
     knt
    Participant

    Not using a child theme is a bad idea if you’re going to be customizing.

    – it’s okay @sharmstr, i don’t like child themes because it request another file, i don’t like that, though it’s barely noticeable in performance. I just like to modify the parent theme directly.

    How do i check if i’m on the Activity page?

    Again, the extra sidebar function is all you need to change.

    – How do i change it? It’s in a switch statement. Please enlighten me.

    #70974
     sharmstr
    Moderator

    Buddypress has bp_current_component to check where you are at within the buddypress context.

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

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70975
     sharmstr
    Moderator

    pseudo code

    COPY CODE
    
     function kleo_extra_sidebar()
        {
            $classes = apply_filters('kleo_extra_sidebar_classes', '');
    
            echo '<div class="sidebar sidebar-extra '.$classes.'">'
                . '<div class="inner-content">';
    
            if( bp_current_component() == 'activity' ) {
                echo "This is the activity page.  You custom code here.";
            } else {
                generated_dynamic_sidebar($extra);
            }
    
            echo '</div>'
                .'</div> <!--end sidebar columns-->';
        }
    
    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    This support site is not about custom work. If you need custom development please contact cornel@seventhqueen.com

    #70977
     knt
    Participant

    Awesome @sharmstr, really helpful. I get it now. Thank you very much. Sorry i’m a newbie in buddypress.

Viewing 10 posts - 1 through 10 (of 10 total)

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

Log in with your credentials

Forgot your details?