Okay
  Public Ticket #2238553
Single Page Event but full width
Closed

Comments

  • rtackabury started the conversation

    On the Single Page for my events, it defaults to having the sidebar on the right. Is there a way to make the Single Page use the 'full-width' page template?

  •  795
    Zhivko replied

    Hi,

    Add this filter in your theme functions.php file:

    add_filter('single_template', function ($single) {
        global $post;     // If is not part of plugin single pages return normal
        if (strpos($post->post_type, 'stec_') === false) {
            return $single;
        }
        
        return get_template_part('single-custom');
        
    });

    Replace 'single-custom' with your full-width single page template.



    Stachethemes Developer

  • rtackabury replied

    Thank you - this has been helpful.

    The only issue is when I use this code, for some reason I lose a lot of the content on the Single Event page, such as the location, RSVP button, etc. The only thing that actually stays is the event description.

    As an example, I included a before (with-sidebar) and after (no-siderbar) example.

  •  795
    Zhivko replied

    Hi,

    Sorry for the delay.

    I'll take a look at the filter again and will update you on the issue.


    Stachethemes Developer

  •  795
    Zhivko replied

    Try the filter with priority number 9999. Example:

    add_filter('single_template', function ($single) {
        global $post;
        // If is not part of plugin single pages return normal
        if (strpos($post->post_type, 'stec_') === false) {
            return $single;
        }
        
        return get_template_part('single-custom');
        
    }, 9999);



    Stachethemes Developer