Viewing 8 replies - 1 through 8 (of 8 total)
  • WordPress’ template hierarchy doesn’t support this ‘out of the box’. But you could easily use if statements inside single-event.php to modify the output (i.e. if in category x do this, if in category y do that):

    global $post;
    if ( has_term( 'x', 'event-category', $post ) ){
      //do this
    }elseif( has_term( 'y', 'event-category', $post ) ){
      //do that
    }else{
      //do default.
    }

    Alternatively you can run a check on the single_template filter and load single-event-x.php, single-event-y.php etc as appropriate. This method is outlined in this WordPress StackExchange answer.

    You would then need to ‘turn off’ the plug-in handling of the template files – see settings – (and so ensure your theme contains all the template files).

    Or else use template_include filter instead (with priority greater than 10). template_include is a more general filter, so you’ll want to run a is_singular('event') check on it.

    The reason is that the plug-in template handling happens on the template_include hook which is fired after single_template.

    Thread Starter Daniele

    (@lele_82)

    Thank you friend!!

    Thread Starter Daniele

    (@lele_82)

    When i created the PHP filter file, how can i call or activate it?
    It must be a single file or the code must add into the event organizer plug-in?

    If using the Stack Exchange solution, put the code in your functions.php and the templates wherever you pointed to in the hooked callback function my_single_template.

    Thread Starter Daniele

    (@lele_82)

    understood… but how can i call the hook? I have some difficult to understand….

    Thread Starter Daniele

    (@lele_82)

    i inserted the code in function… how can i tell to the function ‘my_function’ to load the single-template-x.php” when there are the events of a specific dategory?

    Thread Starter Daniele

    (@lele_82)

    OK!!! All works!!

    Glad you got it working ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Event Organiser] How to Use different templates for different types of events…’ is closed to new replies.