Help Desk

Altering Layouts

  • Posts: 5 Topics: 1
    | Permalink

    Hey guys,

    I’ve installed The Events Calendar Plugin on my website but it doesn’t seem to be working very well with my theme. For example, the content layout does not appear as full width. I’ve emailed the theme’s support and this is what they said:

    “It is because the page is not full width, as the event calendar is archive page, you need to do it via your child theme: http://docs.oceanwp.org/article/203-altering-layouts
    Show this code to the event calendar support team, and ask them by what code you need to replace “is_singular( ‘post’ )” to put all your event calendar page full width.”

    This is the code:

    /**
    * Alter your post layouts
    *
    * Replace is_singular( ‘post’ ) by the function where you want to alter the layout
    * @return full-width, full-screen, left-sidebar or right-sidebar
    *
    */
    function my_post_layout_class( $class ) {

    // Alter your layout
    if ( is_singular( 'post' ) ) {
        $class = 'full-width';
    }
    
    // Return correct class
    return $class;
    

    }
    add_filter( ‘ocean_post_layout_class’, ‘my_post_layout_class’, 20 );

    I’ve attached a screenshot of the problem. The same problem occurs with the rest of plugins by modern tribe such as community events submission page. I’m not very familiar with coding so how do I solve the problem?

    Posts: 3578
    | Permalink

    Hello Syahmi

    Can you check your settings at:

    Events ยป Settings ยป Display ยป Events template ยป Default Page Template (or test any of these options really).

    Let me know if that solves the sidebar issue.

    Thanks
    Courtney ๐Ÿ™‚

    Posts: 5 Topics: 1
    | Permalink

    Hey Courtney,

    Yup I’ve tested the options and it doesnt seem to solve the problem

    Posts: 3578
    | Permalink

    Thanks for confirming that Syahmi

    https://theeventscalendar.com/support/forums/topic/remove-sidebar/#post-1217054 may have a helpful snippet to use to remove that sidebar. Can you give that a try?

    Thanks
    Courtney ๐Ÿ™‚

    Posts: 5 Topics: 1
    | Permalink

    Hello, I emailed my theme support and this is what they wrote:

    Nicolas replied
    Jan 5, 1:44pm
    Hello, no you misunderstood, I know how to solve this issue, I just need to make the template full width but for this I need to know the template functions. For example to make the single post full width, it is this code:
    function my_post_layout_class( $class ) {

    // Alter your layout
    if ( is_singular( 'post' ) ) {
        $class = 'full-width';
    }
    
    // Return correct class
    return $class;
    

    }
    add_filter( ‘ocean_post_layout_class’, ‘my_post_layout_class’, 20 );

    The function of the single post is “is_singular( ‘post’ )”, I need to know what is the function of the calendar template so I will be able to do the same. Ask them with the example I shows you.

    Posts: 3578
    | Permalink

    Hey Syahmi

    I checked in with our developers. They suggest you try to target tribe_events post type so your code should be

    is_singular( 'tribe_events' )

    You’ll find other helpful functions at

    https://github.com/moderntribe/the-events-calendar/tree/master/src/functions/template-tags

    Let me know if you get this working.

    Thanks
    Courtney ๐Ÿ™‚

    Posts: 5 Topics: 1
    | Permalink

    Hey Courtney,

    I’ve managed to remove the sidebar and this is what I used:

    function my_post_layout_class( $class ) {

    // Alter your layout
    if ( tribe_is_event()
        || tribe_is_view()
        || tribe_is_list_view()
        || tribe_is_event_category()
        || tribe_is_in_main_loop()
        || tribe_is_day()
        || tribe_is_month()
        || is_singular( 'tribe_events' ) ) {
        $class = 'full-width';
    }
    
    // Return correct class
    return $class;
    

    }
    add_filter( ‘ocean_post_layout_class’, ‘my_post_layout_class’, 20 );

    However, there are still sidebars on these pages:

    https://www.ukeconline.com/new/events/community/add
    https://www.ukeconline.com/new/events/community/list

    Why doesn’t it work? Is there another function to add?

    Posts: 3578
    | Permalink

    Hi Syahmi

    It’s hard to be sure without having your theme handy, but you could try to replace

     
     if ( is_singular( 'post' ) ) {
            $class = 'full-width';
        }
    

    With:

     if ( function_exists( 'tribe_is_event_query' ) && tribe_is_event_query() ) {
            $class = 'full-width';
        }
    

    Let us know how this goes.

    Thanks
    Courtney ๐Ÿ™‚

    Posts: 5 Topics: 1
    | Permalink

    Hey Courtney,

    It didn’t seem like the code worked.I tried saving it but it said that there’s an error and the changes were rolled back. Here is what my theme support said:

    Hi, I try to make all the events pages on my site in full width with the theme I use, I managed to do it for almost all the events pages but not for this one: https://www.ukeconline.com/new/events/community/add
    I cannot manage to add it in full width. Here the code I use:
    function my_post_layout_class( $class ) {

    // Alter your layout
    if ( tribe_is_event()
        || tribe_is_view()
        || tribe_is_list_view()
        || tribe_is_event_category()
        || tribe_is_in_main_loop()
        || tribe_is_day()
        || tribe_is_month()
        || is_singular( 'tribe_events' )
        || ( function_exists( 'tribe_is_event_queryx27;' ) && tribe_is_event_query() ) ) {
        $class = 'full-width';
    }
    
    // Return correct class
    return $class;
    

    }
    add_filter( ‘ocean_post_layout_class’, ‘my_post_layout_class’, 20 );

    I’m sure it is simple, but I can’t find the function to make the page above full width, can you give me what function of events calendar I need to use?
    Thank you very much.

    Posts: 5 Topics: 1
    | Permalink

    Hey Courtney,

    It didn’t seem like the code worked.I tried saving it but it said that there’s an error and the changes were rolled back. Here is what my theme support said:

    Hi, I try to make all the events pages on my site in full width with the theme I use, I managed to do it for almost all the events pages but not for this one: https://www.ukeconline.com/new/events/community/add
    I cannot manage to add it in full width. Here the code I use:
    function my_post_layout_class( $class ) {

    // Alter your layout
    if ( tribe_is_event()
        || tribe_is_view()
        || tribe_is_list_view()
        || tribe_is_event_category()
        || tribe_is_in_main_loop()
        || tribe_is_day()
        || tribe_is_month()
        || is_singular( 'tribe_events' )
        || ( function_exists( 'tribe_is_event_queryx27;' ) && tribe_is_event_query() ) ) {
        $class = 'full-width';
    }
    
    // Return correct class
    return $class;
    

    }
    add_filter( ‘ocean_post_layout_class’, ‘my_post_layout_class’, 20 );

    I’m sure it is simple, but I can’t find the function to make the page above full width, can you give me what function of events calendar I need to use?
    Thank you very much.

    Posts: 3578
    | Permalink

    Hi Syahmi

    I have submitted this on for additional testing on our end. I will get back to you soon with our results.

    Thanks
    Courtney ๐Ÿ™‚

    Posts: 3578
    | Permalink

    Hi Syahmi

    I spoke with one of our developers. They suggested the following:

    It looks like your theme comes with a template override for default-template.php and that is causing this. You could override that template override in the child theme folder or to use a snippet

    remove_action( 'ocean_display_sidebar' );

    for all calendar templates.

    If you opt for the template override, then copy the same file in the child theme and remove line 40 that does

    <?php do_action( 'ocean_display_sidebar' ); ?>

    or simply copy our original default-template.php into the override folder.

    Thanks
    Courtney ๐Ÿ™‚

You must be logged in and hold an active support license to create new topics in the help desk. Please visit our products store to purchase a license.

Subscribe to Updates