• Resolved nervino

    (@nervino)


    Hello, I want to override a wp-event-manager template through code.
    Wp Event Manager documentation says to apply a filter in this way:
    return apply_filters( 'event_manager_locate_template', $template, $template_name, $template_path );

    At the end of my function.php I put:
    return apply_filters( 'event_manager_locate_template', '/wp-content/themes/Divi-child/wp-event-manager/', 'content-event_listing_custom.php', 'content-event_listing' );
    but nothing change…

    Is my code correct?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi @nervino
    You don’t need to override template via code. By default it will override if you create folder here /wp-content/themes/Divi-child/wp-event-manager/

    Once the folder is created copy the template file from the plugin and put it on the above path. https://wp-eventmanager.com/knowledge-base/template-files-override/

    It should fine.

    Thank you

    Thread Starter nervino

    (@nervino)

    Thank you for your reply, Hitesh. I know I can override templates in that way (please, see the path I’ve put in my function.php). I was trying to implement the override through code in order to use different templates based on conditions (IF ELSE..).
    However, I solved using a different approach, inserting the conditions inside the template.

    Hi @nervino

    Glad to hear that you have solved it.

    Thank you

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Template override through code’ is closed to new replies.