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 get the active theme’s slug?
- How to add plugins to wordpress theme?
- Plugin (or Theme) containing its own Plugins?
- 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
- Why users disable the WordPress update?
- 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]
- Woocommerce sidebar not loading in theme
- 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?
- Linux Permissions and Ownership for WordPress
- 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
- Overwrite category head title
- Create a single website with 3 theme options in wordpress
- Create custom pages with a plugin
- Does heavy theme and plugins affect server’s response time? [closed]
- Proper way to use plugin functions in functions.php
- Use different single.php file based on condition
- how remove font to increase site speed load
- Use $variable from file1.php in file2.php (different file paths)
- What is the purpose of WP_CONTENT_URL?
- How to translate WP Blog (search, category etc.)?
- issue in wp_localize_script
- How can I use my custom wordpress theme on two websites? [closed]
- How to remove products-links after the product title using remove_action
- Can I filter a function created by a theme or a plugin?
- 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
- Detect plugin/theme installation (via upload)
- How to check homepage contain blog post?
- how to design change in woocommerce cart page and all other page also by theme? [closed]
- is there a way to pass a parameter to a add_menu_page function?
- plugin inside a wordpress theme
- Share plugins, themes, and multi post in a multidomain network
- Removing the custom_image_header from wp_head
- Gantry Framework: new page loads homepage content instead of page content
- Upgrade not working & themes not supporting
- Plugin Admin panel checkbox unchecked after submit
- use EDD Content Restriction for restricting php in template
- admin-ajax.php 500 error when new users try to register
- Elementor Sidebar not loading when PRO elements plugin is active
- Elementor pro page editing gives error There has been a critical error on this website. Please check your site admin email inbox for instructions
- how to display a template.php in a shortcode
- What plugin would make this happen? If is the theme
- WordPress site hamburger menu toggle not working
- WordPress wp get_temp_dir return non exiting folder, thus failing plugin & themes update
- Removing Plugin Action via Theme for Non-admins
- when i activate my WordPress plugin cannot see customizer options or preview
- Writing SEO for Homepage when homepage is set to display latest posts
- Fatal error: Class ‘RDTheme’ not found
- Getting unknown text in footer of email
- How to fix blog article view and share #’s?
- Description: Too much time has passed without sending any data for document
- When the user entered an unauthorized url redirect to login page
- How can I make the search bar in my wordpress site search all of the pages rather than just the blog posts?
- I want add repository theme folder
- How to make a website with two types of logins , Sellers and buyers?
- Ajax specific template not loading in replacement of index.php
- Need Help Creating a Multi-Step, Video-Guided Enrollment Site
- Issues with Post 2 Post Plugin
- Disqus plugin outputs script as literal text
- How to get current template file used by WordPress?
- How can I modify the colors of my theme for a single section of my site? [closed]
- How to work email subscribe in WordPress?
- Terms id wordpress error
- How to add a plugin in WordPress theme directory?
- Extra Text in Home URL
- WP Customer Reviews call short code on another page [closed]
- How to make wordpress backend mobile optimized.?
- Editing a theme
- What is phpBB? Is it something like a plugin which I can use in WordPress? [closed]
- WordPress theme is not displaying the correct home page in the Pages section
- Newspaper theme, custom query vars, & custom rewrite rules