Support » Plugins » Hacks » Plugin to Register Theme Options

  • I am using a theme that has Page Attribute options with a dropdown of page templates. Like Full page, left sidebar ect…

    Then I have another plugin with a custom post type. But it needs to have the themes Page Attributes to select the page template.

    Template options on right:

    Plugin Page

    I got the plugin to acknowledge ‘page-attributes’ but I do not know how to carry over the themes options.

    Well versed in PHP, 20yrs. Still fairly new to WP and how it works.

    I just need to be pointed into the right direction. Both Plugin and Theme I have customized on my own, downloaded and modified to my own likings. So do not care about editing either as they will not be updated normally.

    Seems like the plugin needs to read the template. I know where to add it, but what to add and to make sure it saves it I suppose is what I am needing?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Steven Stern (sterndata)


    Forum Moderator & Support Team Volunteer

    Custom Post Types do not support the page template option.

    Moderator bcworkz


    Steve is right of course, but you can cause a specific template be used for your CPT, or even specific post slugs, by properly naming the template file.

    You could also cause an arbitrary template file to be used through the ‘single_template’ filter. The requested post ID can be determined with get_queried_object_id(). If the desired template file is stored somewhere related (such as post meta), where it is accessed by post ID, get the template path/name and return it.

    You can’t get the page template drop down in the usual Attributes box, but you can enter the right template in custom fields or a meta box of your own creation.

    Moderator Steven Stern (sterndata)


    Forum Moderator & Support Team Volunteer

    Another option is to use “post formats” and bend them to your will.

    Thread Starter Neotropic2023


    Thanks everyone.
    bcworks gave me an idea with setting what I need in a custom field. Then followed the link above and came across get_page_templates().

    My other option was to create my own array of the list of templates and manually add it to the meta box as a drop down in the plugin.

    Led me in some right directions, thanks again.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Plugin to Register Theme Options’ is closed to new replies.