WordPress had a built-in conditional tag for that:
if ( is_page_template( 'page-courses.php' ) ) {
include_once('functions_courses.php');
};
Related Posts:
- What is singular.php?
- Page Template as Custom Post Type Archive
- Action hook on Edit custom post type?
- Add Content to Page without shortcodes
- How to intercept publish post for a custom post type “event”
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- How to show more posts on an archive page?
- Make the ‘all’ filter default instead of ‘mine’ in a custom post type
- Assign Page Template Within A Custom Post Type
- Custom post type archive and single.php files not working
- Page Templates – this code only works for one Custom Post Type
- Custom Post Type – Archive page title
- WordPress custom post type Single.php?
- action init hook and get_post_types
- How do I create a custom post type for a training CMS in WordPress?
- Custom post type archive sorted and grouped by date in post meta field
- What hook should be used to programmatically create a post only when master post is updated?
- How to register custom post types in a plugin?
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- Custom Post Type slug same as page name causing a conflict
- Control Custom Post Type template from a plugin
- Detect if 1st, 2nd or 3rd level custom page?
- update_post_meta() whenever custom post type is updated
- Create second custom 404 page for selected post type
- Hyphens instead of Underscores in Post-type Archive Template Filenames when Post-type handle contains underscore
- Check Title Unique Or Not and If not error message and dont save
- Help with CPT template pagination
- After updating a page, all pages on the site used the index.php template
- Using custom page templates with plugin [duplicate]
- Can I make WordPress use a custom template for a child page
- Add html to cpt main page / admin edit.php
- register_taxonomy and register_post_type does not work [closed]
- Create Template for Custom Post Type same like for Page
- How to load a template without it being assigned to a page/post?
- Custom template with CPT doesn’t display on frontend
- create a template page for a post
- Custom post type archive page template
- Custom Post Type with Templates using Meta Boxes?
- Posts are duplicating on wp_post_update
- Custom page sidebar using Template dropdown box
- A method for ordering mixed dates in search result loop (theory only, no actual code)
- How do I add a custom screen for a custom post type to be called from custom post row action?
- Custom post type suppress transition from future to publish
- How to render a custom post type template with custom fields using shortcode
- Adding the_content() in custom template email
- Filter Posts from the Main Query
- next_/previous_post_link() `in_same_category` appears to fail when true
- Multiple templates for single custom post type
- WordPress Custom Search by post_type
- Pages Become “Archive” Instead of Using Page Template
- Custom post type pages return 404 page?
- Multiple single templates?
- Custom URL redirect in WP
- wp_trash_post action hook with custom post type
- How do I amend form data before it is saved for a custom post type
- Page Template Dropdown For Custom Post Types
- providing access to post_id or post inside functions.php
- wp_get_canonical_url showing first url of the post for custom page
- How to get the current category with custom posts
- Types plugin custom post add_action hooks
- Enabling permalinks disables custom page template
- Loading plugin text domain before registering post type
- Custom Post Type Specific Post Template
- Mixing Custom Post Types and Page Templates in WordPress 3.7.1
- Custom Post Type Template Insert not working properply
- Loop and add Specific Categories and Products Images
- custom post template ignored after altering permalinks
- Custom Post Type page template doesn’t show up
- How can I allow users to edit text that will be displayed on a custom post type archive page?
- Display ONE taxonomy and its assigned pages
- How to recover the post ID earlier in the WP admin hook action “firing” sequence?
- Using `set_transient()` when saving a custom post type
- Modify Custom Post Type Slug
- WordPress Page hierarchy ( parent is singular of custom post types slug ) is returning not found
- How can I create a button that when clicked populates a div with a list of foods that are checked as a certain type of ACF?
- Custom post type not pulling CSS
- How can I use a custom template to load custom post type posts based on a post_meta value
- Showing Custom Post Type with his templates on a custom page template
- Displaying posts inside table having issues
- Keep br tags from stripping
- Show index and not the archive for “Dog Custom Post” with default slug
- Ordering Posts List By Taxonomy Terms?
- Loading a template for a URL pattern
- do action inside a class is not working
- Custom Homepage As Single Page or Custom Post Type?
- Custom Post Type Pagination Not Working or Single Posts Displaying?
- Templates list in “Page Attributes” metabox is inaccurate
- Custom Post Type & Page Template
- Modifying and Displaying URL’s in a Post Template using parse_url
- What is the proper way implement a global $wp_rewrite?
- Multiple search template with separate stylesheets
- Dynamically change post_parent in every page load?
- Using custom post types within a section of a template
- Custom Post Type order Title ASC
- get tags from custom post type
- Dynamically change Custom Post Type Template OR Change Permalink?
- Page templates for custom post types
- using a template for more then 1 page
- display related posts based on the PAGE TITLE
- Multiple search forms and respective results page templates?