You have to use the Slug of your Custom Post Type “portfolio” for the filename, as you pointed out, single-portfolio.php
is correct if your slug is “portfolio”.
You just have to take one more step, create the file in the Theme directory (the same folder where your single.php
is located).
WordPress automatically selects the single-portfolio.php
for the Portfolio CPT if the file is there, and if it is not there, it takes the single.php
.
Related Posts:
- Custom CSS is overwritten by WordPress?
- How can I get the title attribute from get_the_post_thumbnail()?
- Retaining old HTML archives and displaying themes conditionally
- Change Default Image HTML
- Edit raw HTML of the landing page
- In which directory do I find a specific HTML code of my wordpress page? Some of it seems to be missing after checking all pages [closed]
- Can I apply a WP theme to a specific custom page template?
- Can I create multiple instances of the BuddyPress Activity Stream with separate themes? [closed]
- How do I apply my CSS to a theme page?
- How to use get_page_by_title() with qTranslate?
- Display a specific dynamic sidebar widgets on a specific page
- Multi-level page hierarchy
- Understanding Theme specific Code
- Own Theme Customizer displays error message when saving, saving still works
- Theme option not saved if in wp_editor() and html decoded
- Customizing page content layout
- Putting two themes together to create a complete site
- How does WP generate html?
- Finding and disabling ‘rogue’ stylesheet from header: Source Sans Pro
- Make multiple pages and set template/content on theme activation?
- How to restore file or theme?
- How to transform a custom made static HTML website to a WordPress website [closed]
- Need to edit themes HTML code
- Modifying the markup in the Tag Cloud widget?
- WP HTML Templates – Any way to get bloginfo() or the path to the theme folder?
- How to trace and resolve a theme problem such as flickering links in WordPress? [closed]
- How to edit the font color of the H1 on a single page?
- How to use custom page templates in a theme that hides page template option?
- Setting a new default template for the creation of a page
- Index page is not working
- Insert the current theme header into an external HTML/XHTML file
- Custom theme – pages in menu
- remove preloader in WordPress theme [closed]
- removing side space between para and container on generatepress?
- share wrordpress data between two shared hosts using REST API
- TwentyFourteen Theme : Changing grid layout
- Meta title W3C Validation Error with
- adding a unique page to an existing site
- Standard Way To Do Custom Work Within A Page?
- separate home page into separate pages
- wordpress template page Usage [duplicate]
- Help with responsive theme styling issue
- Remove ALL HTML from single page
- Why do pages look good when logged in to Admin but not when logged out
- Trouble with formatting buttons in WordPress:Twenty Twenty-Four [closed]
- How to change background color in the Notepad++ text editor?
- How to change or add theme to Android Studio?
- WordPress frameworks and parent themes [closed]
- Opinions and recommendations on the best barebones base theme [closed]
- Remove JSON API links in header html
- Using OOP in themes
- Where can I download WordPress themes from? [closed]
- How can I allow the Editor Role to change Theme Settings?
- What are all the available parameters for query_posts?
- Customizing a WordPress theme without changing it?
- Where can I learn to create my own theme?
- How do I turn off self-closing tags for markup in WordPress (for HTML5, or HTML4, for example)?
- how to add version of style.css in wordpress
- Does WordPress work without a theme?
- What is the role and history of the $content_width global variable?
- Adding admin-ajax.php to the frontend. Good or bad idea?
- How to move the sidebar in TwentyFifteen to the right?
- How to Link External jQuery/Javascript files with WordPress
- Installation failed: Download failed. No working transports found
- What is theme-compat?
- Override parent theme translation on child theme
- WordPress Theme activation hook?
- Can wordpress theme folder name be changed freely and nothing technically happens
- Link to specific Customizer section
- What does exactly GPL license mean for my WordPress theme?
- Am I allowed to license my WordPress theme under the aGPL
- How do I change the header image height in Twenty Seventeen?
- Starter Theme vs Parent Theme? Pros and cons
- How to change the language for the front-end only?
- W3 Total Cache, CDN and theme files [closed]
- Best way to include Bootstrap in WordPress
- How to set thumbnail image for a (child) theme
- Different template of products for specific category. WooCommerce
- Show different theme for admin?
- How can I version the main CSS file?
- what the best way to include images from the template’s images folder?
- Is it OK to remove theme credits from footer? [duplicate]
- Undefined offset: 0 in > […] /wp-includes/capabilities.php on line 1067
- Dash or underscore in theme folder name?
- No “Add New” Button. How to add new theme?
- How do I add support to my theme for custom menus?
- “Unexpected error” on update requests
- How to prevent plugin, theme installation failures on WordPress?
- How do I white label my self-hosted site created by wordpress?
- Do Child-Themes automatically load the Translation from the Parent-Theme?
- When cropping a header image, retain meta data (i.e. name, description, etc.) from original image?
- Best practices for a Style/CSS based theme options page?
- How to create a new theme from scratch?
- Categorising themes by folders in backend
- Switching themes without losing widgets?
- How to use media upload on theme option page?
- Why doesn’t default WordPress page view use force_balance_tags?
- Dynamic template serving, change theme_root using add_filter from current theme
- What theme is good for posting code? [closed]
- WordPress 5 / Gutenberg – theme doesn’t have featured image option showing up