Theme-wide custom post template – WordPress Development Stack Exchange

Question

I am writing a custom theme. It has several custom post/page templates, which are selectable from the drop-down on the Edit Post/Page page. Is it possible to make a theme-wide Customizer setting that sets one of those templates as the default single post/page template to use, when no custom template is selected? (e.g., when the selected value is “Default template.”) Thanks in advance.

in progress 0
wavetree 2 years 2021-04-28T08:19:51-05:00 0 Answer 0 views 0

Answer ( 1 )

    0
    2021-04-28T22:50:30-05:00

    This actually shouldn’t be too hard if you apply the ‘template-parts’ model… …so by default WordPress has it’s page.php and single.php and archive.php… …what you’d want to do is just ensure that for the segment where they load content, you’re calling on the same template part to display the content. You can even match the HTML in each of those files so that it looks the same, that’ll be the default.

Leave an answer

Browse
Browse