WordPress had a built-in conditional tag for that:
if ( is_page_template( 'page-courses.php' ) ) {
include_once('functions_courses.php');
};
Related Posts:
- How to enqueue scripts on custom post add/edit pages?
- remove custom post type permalink
- What is singular.php?
- What are the differences between custom post type and custom page templates?
- Page Template as Custom Post Type Archive
- Setting a custom sub-path for blog without using pages?
- How to change “Draft” string for status of custom post type to “Unavailable”?
- Action hook on Edit custom post type?
- Add Content to Page without shortcodes
- Unregister post type from child theme
- Custom post type save_post action not firing
- How to correctly get post type in a the_title filter
- How to intercept publish post for a custom post type “event”
- Loading custom page template via plugin
- Why The Init Hook For Custom Post Types
- Post formats “audio” and “video” only showing in index.php
- Ordering Posts List By Taxonomy Terms?
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- Creating a Custom Post Type for Inserting Preset Content into Post & Pages?
- How to show more posts on an archive page?
- WordPress keeps fetching the archive page instead of the template page
- How to add custom template in plugin?
- How to quickly switch custom post type singular template?
- Add a Template to a custom post type
- How to use a dedicated template for the Custom Post Type from a plugin?
- WordPress calls archive page instead of Custom Page Template
- How do I Make a custom post type get a custom post template in a plugin
- With what hook can I address all posts from all custom post types when they are published?
- How to sort list of custom posts to get view like a tree of posts under categories and their children’s categories?
- Make the ‘all’ filter default instead of ‘mine’ in a custom post type
- Dynamically Create Terms in Taxonomy when Custom Post Type is Published. Almost There!
- Assign Page Template Within A Custom Post Type
- Dynamic page.php template for custom post types
- Custom post type archive and single.php files not working
- WordPress Custom Shortcode Conflicting with Media Library
- Page Templates – this code only works for one Custom Post Type
- Pagination on a custom page template
- Custom Post Type – Archive page title
- WordPress custom post type Single.php?
- WordPress custom post action hook
- action init hook and get_post_types
- Multiple templates for custom post type
- 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?
- Custom Post Types, Page Templates and Pagination. Why do I get a 404 Error?
- How do I create a page template to display a custom post type?
- pre get posts changing the query
- How to register custom post types in a plugin?
- Actions that Run on Admin Edit Page Load After Posts Are Queried
- How to make an archive page displaying posts in a date range
- Display Posts of a Category in Alphabetical Order (Custom Post Type)
- 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?
- Using pre_get_posts to Filter Posts
- Remove “Get Shortlink” button in admin of custom post type
- update_post_meta() whenever custom post type is updated
- Create second custom 404 page for selected post type
- How to get Custom Post ID by adding filter to child theme’s function
- is_page_template not working as expected
- Child page in custom post throws 404 page not found
- CPT: archive-cpt.php VS custom page template
- Custom post_type search’s $wp_query->query_vars do not correspond
- Multiple portfolios with one custom post type?
- Take Variables Set in Functions.php and Echo Them Inside My Custom Post Template
- Hyphens instead of Underscores in Post-type Archive Template Filenames when Post-type handle contains underscore
- custom post type archive slug vs. custom page template
- Custom Post Type Pagination Not Working or Single Posts Displaying?
- How to create a custom template for this custom post type?
- Templates list in “Page Attributes” metabox is inaccurate
- Nested custom post types templating
- Custom Post Type & Page Template
- Query custom post type and showing its content
- How to divide posts (custom post type) content on multiple pages?
- Modifying and Displaying URL’s in a Post Template using parse_url
- Display Custom Taxonomy of custom post type
- Custom page template not recognized with permalinks on
- 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
- How do I paginate a custom post type listing on a custom template page?
- Custom Post Type order Title ASC
- get tags from custom post type
- Create action running on trashed_post hook to modify post_meta value
- Dynamically change Custom Post Type Template OR Change Permalink?
- Page template anomaly
- Custom post type functions.php if statement on action
- Custom Post Type Template Based on Page Slug?
- Page templates for custom post types
- using a template for more then 1 page
- Adding custom theme template to custom post type [duplicate]
- Can you programme the selected page template to display block patterns automatically?
- display related posts based on the PAGE TITLE
- I want to show a list of posts under specified categories
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs
- Multiple search forms and respective results page templates?
- How to create download page with countdown in wordpress?
- Add a post when another post type is inserting