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
- Trouble with formatting buttons in WordPress:Twenty Twenty-Four [closed]
- How to place HTML tags in content from the_content()?
- How can we hide the parent’s theme url at the child themes details on a multisite?
- Change the name of the root name of an already built WordPress theme
- Tips for managing code when developing a parent theme framework
- How can I show full text, not summary for the homepage and in categories?
- Wp theme not working well as forgot to create child theme [closed]
- Theming global variables – initializing in index.php but using in header.pho
- Understanding the theme details in style.css
- Need a theme that let the posted content stretched maximum width [closed]
- Copying post thumbnail to custom field
- How to override theme class function to child theme? [closed]
- Trying to fix a website that was built with WordPress and then taken off of it
- How to integrate JSS to WordPress
- How to track a users last visited page?
- How to remove a large ugly space from my wordpress site?
- Moving the search bar to be in menu bar
- Why cant I change the text on this theme?
- Why I obtain different visualization when I run the website on my local machine and on remote server?
- enqueue_script doesn’t work with HTML5 blank theme
- Get WP Install Directory
- How can I add text on top of slideshow? [closed]
- Display Headings on Index page in different font sizes
- Using DePo Masthead with WP 3+
- Whitespace between logo and site title in Twenty Twenty-Two
- Load elements without reload page [closed]
- How to validate new added field (Phone number) which is added to registration form?
- How do you remove the “The Link You Followed Has Expired” error for a subfolder website?
- Any way that guest users see the site as registered users?
- adding pages in underscores.me theme
- Child theme not activating despite success message
- Webflow Interactions on WordPress site?
- After changed url from http to https, it says “This site can’t be reached”
- My theme is adding an unmatched end tag and outputting it to my screen
- WordPress 404 on style.css but not on all pages
- Is a dynamic website with lots of urls possible with wordpress [closed]
- Edit box-header on WordPress Dashboard
- Is there significant risk in not keeping a theme updated? [closed]
- Sticky header for wordpress changes size and logo size as I scroll down
- One-Page WordPress Template
- How to assign a Category to a Page, when both are created on theme initiation?
- Copy from wordpress for dev gives different output in browser
- When translating not all string are present in POedit
- How to retrieve images attached to post through media library?
- How to fetch the no. of Users dynamically?
- spacing disappears on posts when importing
- Create a child Theme or custom Theme
- Capcha not getting displayed
- Starting fresh on a blank “theme” [closed]
- Mystique theme: widgets on sidebar falling under the page content
- Adding a wp_head hook from an included PHP file
- get_page() unlike Loop returns the post content without html tags. How can I fix this?
- Deleting Widgets in sidebar in Panthea theme
- How to add custom css/js files to a template in wordpress
- Font Awesome Icons as squares [closed]
- Why won’t local-site theme update on iPadOS Safari?
- Child theme removes the “id=” from main theme