• Resolved glassraven

    (@glassraven)


    Hi Guido,

    Just a quick question regarding the single-event page template to allow customisation of the events details page.

    I’m using 2 categories on a website – one for showing public events (publicly accessible) and another which is in a protected area for logged in members.

    The main website uses the full width template, but everything within the members area has a sidebar – however I cannot work out the code needed to force my sidebar layout within the single-event template.

    Within my single.php file (for general blog posts in the members area) I am using one of 2 things either:

    if( in_category('members') )
    or
    if ( in_category('1') )

    Of course I have edited it to be a unique category slug & ID for the events category, but neither using the slug nor the ID of the category is working within the single-events template though. I assume you are using something other than the usual wordpress post categories.

    Can you help? Thanks in advance ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Guido

    (@guido07111975)

    Hi,

    Please create a duplicate of file “single” and rename it to “single-event”. Now a single event will use this file instead of the “single” file.

    Inside this file do a check if user is logged in:

    
    <?php if ( is_user_logged_in () ) {?>
      // do your stuff
    <?php } ?>
    

    You can do this check twice:
    1) to determine which CSS class is being used for the page container (full width or with sidebar)
    2) to determine whether to show sidebar or not

    Will this work for you?

    Guido

    Thread Starter glassraven

    (@glassraven)

    Hi Guido

    Thanks for the reply

    Sorry maybe not clear, I’ve got all my logged in user stuff working perfectly – what I need is to know what category of event the event is in.

    I already have a single-event page setup, checking if the user is logged in etc. but it needs to be private (logged in) for one of the 2 categories events only – not the other.

    Does that make sense?
    Thanks
    Sadie

    Plugin Author Guido

    (@guido07111975)

    Hi Sadie,

    To get a certain event category, you can try to use has_term() in file single-event:

    
    if( has_term( 'your-event-cat', 'event_cat' ) ) {
        // do something
    }
    

    (this should be inside the loop)

    Guido

    Thread Starter glassraven

    (@glassraven)

    Thanks Guido – that’s perfect!

    Working great now ??

    Plugin Author Guido

    (@guido07111975)

    Great, thanks for letting me know.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Single-event page template questions’ is closed to new replies.