Here is the code that will let you return your single-event.php if the post type is event:
function my_event_template($single_template) {
global $post;
if ($post->post_type == 'event') {
return dirname( __FILE__ ) . '/single-event.php';
return $single_template;
}
add_filter( "single_template", "my_event_template" ) ;
Related Posts:
- Disable plugin / plugin action via theme
- Where can I sell WordPress themes and plugins? [closed]
- What are the package and subpackage comment for?
- Experiences with adding Nonces to the comment form
- How to add plugins to wordpress theme?
- Disable author pages for specific users
- Set active theme via URL
- How do I make my wordpress page more friendly for mobile viewers?
- Check javascript file Proper way in functions.php
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- dequeue not work
- Recommendations for books/resource to get started with wordpress 3 development (plugins/themes) [closed]
- Uncaught Error: Call to undefined function get_user_by() after moving function from theme to plugin
- Translating plugin inside the theme [closed]
- How to Implement “Notice: This theme recommands the following plugin:xyz” in wordpress? [closed]
- Change settings of get_post_type_object
- Sage WordPress – Plugin Namespace: Not Found
- Unable to install theme recommended plugins on Multisite
- More than one text-domain is being used because of the included templates for plugins
- How to prevent users to download videos from lms website?
- Different UI in WordPress
- plugin style conflicts, how to override? [closed]
- Hooking in to replace the Sidebar/Widget areas
- There is any way to remove post-format filter? [closed]
- Child Pages Short Code plug-in and hover capabilities?
- WordPress site periodically goes down
- Masonry images not working
- Why namespaces are rarely used in WordPress plugins?
- (Big issue) Blog is Getting Down Each day.. what should i do.?
- How to require users to login when not logged in
- Error when using plugin QuickCache with plugin Mobile Smart ? [closed]
- How do I find out what is in control over a certain part of a website?
- How do I combine a theme with a plugin
- Where are theme codes located for WordPress?
- Overwrite category head title
- Create a single website with 3 theme options in wordpress
- using do_shortcode
- How to load different homepage on Mobile.?
- How to get menu location in wp_update_nav_menu hook
- Use different single.php file based on condition
- Which wordpress theme is compatible Optima Express theme (real estate inventory) plugin?
- How to Include File from Plugins into Template?
- How to execute plugin and theme updates from a web hook / endpoint?
- How to translate WP Blog (search, category etc.)?
- issue in wp_localize_script
- How do I set up XAMPP to allow me to download plugins and themes?
- How to remove products-links after the product title using remove_action
- Licensing options for WordPress Plugins
- How I update WordPress theme and plugins
- Overwrite add_image_size defined by theme
- Don’t load the theme for a page FROM a plugin EDITED
- Extending a theme: build new features as plugin or core modules?
- Detect plugin/theme installation (via upload)
- is there a way to pass a parameter to a add_menu_page function?
- Is there a Image Gallery which will load all my posted Images like twitter’s image grid?
- What is the most efficient way of adding additional functionaliy for admin only
- How do I work with the SlideDeck plug-in?
- Plugin Admin panel checkbox unchecked after submit
- “User need to be logged in in order to make a booking” issue
- Custom Plugin scripts from admin working in frontend
- admin-ajax.php 500 error when new users try to register
- Scrape key check failed. Please try again
- Elementor Sidebar not loading when PRO elements plugin is active
- Disable WordPress Theme Browser and Plugin Browser
- Sold out Label for variable products which are partially sold out
- Create automatic latest version link
- How to Access a file that is inside a plugin’s dir from the theme’s `functions.php` file
- how to display a template.php in a shortcode
- dokan edit functionality
- how to split and upload a theme on wordpress?
- Removing Plugin Action via Theme for Non-admins
- Fatal error: Class ‘RDTheme’ not found
- Multisite converted to Single Site can’t add new plugins or new themes
- How to fix blog article view and share #’s?
- When the user entered an unauthorized url redirect to login page
- how to add navigation icons in specific template?
- I want add repository theme folder
- How to make a website with two types of logins , Sellers and buyers?
- Shows warning when enable “wp_gallery_custom_links” plugin with Themify Builder
- Why all my wordpress sites keeps telling me that everything is up to date at /wp-admin/update-core.php?
- How can I save cookies to members
- How to add separator between default and custom panels in WordPress customizer?
- Speed issues because of CSS & JavaScript
- Ajax specific template not loading in replacement of index.php
- Woocommerce: deleted single-product.php, everything still works. How is it possible?
- pluggable function in theme, to be overridden by plugin
- How to tell if a script is being executed from a plugin, a theme or a child theme in WordPress?
- jquery-issue: cannot load the basic jquery
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- How can I modify the colors of my theme for a single section of my site? [closed]
- How to work email subscribe in WordPress?
- how to change location of the plugins & wordpress themes folder
- How to add a plugin in WordPress theme directory?
- Extra Text in Home URL
- WP Customer Reviews call short code on another page [closed]
- Editing a theme
- Self-hosted Plugins & Themes store with auto-updates? [closed]
- Am having issues intergrating this api into my wordpress site, any help please?
- How to add links to different language versions of WordPress
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)