• Resolved scamrwordpressadmin

    (@scamrwordpressadmin)


    I have customized the single-event.php page and it works awesome for the majority of our hike events.

    We will have some days where there will be no event, and I’d like to put that on the calendar too. In order to do that and not have all of the custom forms, shortcodes etc – I’d like to create a simple event page that I could use just for the NO HIKE events.

    Is it possible to have more than one event template, and if so, how would I select it when I create the event?

Viewing 1 replies (of 1 total)
  • Thread Starter scamrwordpressadmin

    (@scamrwordpressadmin)

    RESOLVED:

    1. Using the Advanced Custom Fields Plug-In, I created a custom field called is-there-a-hike. This has a field type of Select, and the options are 1 : YES and 0 : NO. The default value is set to 1 (yes), so I only have to change it in the no hike scenarios. Then in the Location section for this custom field (still in the ACF custom field), the “Show this field group if” is set as “Post Type is equal to tribe_events”. This way this custom field ONLY shows up if I am creating a calendar event – but it won’t show for any regular page or post work.

    I set the Order No (under options right below the Location box) to 0 – so that it will be the first custom field to show for an event. That way, if there is no hike, I can select no on that field and be done quickly.

    2. In my custom single-event.php file. This is stored in my child theme in a folder called tribe-events. DO NOT modify the original Tribe-events file.

    Create a IF/THEN loop so that IF the is_there_a_hike custom field is set to 1 (YES), the information shows, and IF the variable is set to 0 (NO) then the info is hidden.

    <!--  SHOW CONTENT ONLY IF THERE IS A HIKE -->
    <?php $ishike=get_field("is_there_a_hike")?>    <!-- get value from custom field -->  
    
    <?php if ($ishike == 1) {?> 
    
          <!-- stuff you want to show when there is a hike (variable is set to 1 (yes)) goes here -->
    
    <?php } ; ?>
    <!-- END IF, SHOW SECTION ONLY IF HIKE THAT DAY -->

    I’m sure there are more glamorous ways to do this, but it works pretty slick.

Viewing 1 replies (of 1 total)
  • The topic ‘[Plugin: Events Calendar Pro] How to use multiple event templates’ is closed to new replies.