Applying custom formatting to a single page
Permalink
Hi,
I gather that by default all single pages use the view.php template within the applied theme to define the page formatting. We would like instead for a particular single page to match the format of one of our other page types. In our case, that page type (template) is named product_right_sidebar.php and exists within the themes/custom folder.
In the "Customizing a Single Page's Appearance" section of this topic it seems to say that, for a single page named test.php, we can add a copy of product_right_sidebar.php file, renamed as test.php, to the themes/custom folder, and this test.php template will be applied to the test.php page in place of the view.php template. That didn't seem to work.
Am I misunderstanding what "just include a file with the same name as your single page within the theme itself" means, or something else?
Thanks!
I gather that by default all single pages use the view.php template within the applied theme to define the page formatting. We would like instead for a particular single page to match the format of one of our other page types. In our case, that page type (template) is named product_right_sidebar.php and exists within the themes/custom folder.
In the "Customizing a Single Page's Appearance" section of this topic it seems to say that, for a single page named test.php, we can add a copy of product_right_sidebar.php file, renamed as test.php, to the themes/custom folder, and this test.php template will be applied to the test.php page in place of the view.php template. That didn't seem to work.
Am I misunderstanding what "just include a file with the same name as your single page within the theme itself" means, or something else?
Thanks!
If what you're looking for is to create a new "page type" that is a "clone" of another, yes, simply copy the php file to the new name in the same folder, then make sure you add the page type in dashboard > page types !!
No, I wasn't trying to create a new page type. I was trying to override the settings so that a specified Single Page (one not all) will use a template other than view.php.
I did what you suggested and added a new Page Type named "test", but I don't see anywhere to apply it as the page type for a Single Page. I refreshed the page and nothing seemed to apply from the template.
Thanks for your input!
I did what you suggested and added a new Page Type named "test", but I don't see anywhere to apply it as the page type for a Single Page. I refreshed the page and nothing seemed to apply from the template.
Thanks for your input!