This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Override sidebar layout using an API

  • Creator
  • #7667

    I am using a plugin called Sugar Event Calendar by Pippins Williamson and it uses a custom post type called ‘sc_event’ which by default, uses the slug /events/ to render an events list using archive.php. Because the /events/ page isn’t an actual page, I can’t set the sidebar layout through the admin. How can I do this using the Jump Start API?

    For example, if the theme has a default sidebar layout of ‘full width’ set in theme options, the /events/ list will be ‘full width’ as well. I would like to make this list display with a right_sidebar. How can I do that?

    If I wanted it to be left_sidebar, can you show the code for that as well? Another example would be if the default sidebar layout was set to right_sidebar in theme options and I wanted to make it ‘full width’.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Author
  • #7675
    Jason Bobich

    There’s no API function or anything, but there is standard filter on the sidebar layout every time the page loads that you can utilize. — “themeblvd_sidebar_layout”

    See this article:

    I don’t know exactly how the plugin works to know what condition you could use to determine if you’re on an events page or not, but I’m sure Pippin could quickly tell you that part.

    function my_sidebar_layout( $sidebar_layout ) {
        if( some condition ... ) 
            $sidebar_layout = 'sidebar_right';
        return $sidebar_layout;
    add_filter( 'themeblvd_sidebar_layout', 'my_sidebar_layout' );

    That’s exactly what I was looking for. Thank you for pointing it out. I applied this condition and it worked perfectly:

    if( 'sc_event' == get_post_type() )
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.