Forums

Change the theme for each page (Switch Theme by Page) (2 posts)

  1. bmstudio
    Member
    Posted 5 months ago #

    Hello,

    I want to create a plugin to change the theme for each page.
    I create a meta_box in editing page that allows me to select the folder of the theme with a selectbox:

    wp-content/themes/theme_1
    wp-content/themes/theme_2
    wp-content/themes/theme_3

    The variable of the theme is saved as post_meta.

    Now I want to identify the page load of the variable post_meta and change the style and structure of the page depending on the theme file. The problem is that the page loads according to the theme set by default in WordPress.

    I would like that page loads, the choice of theme is done in the appallingly variable and not the general setting of WordPress.

    I want to say that I do not want to just edit a page with:
    <? php / * Template Name: My name page * /?>
    But completely change the theme folder

    Is this possible?
    Thank you very much,

  2. bmstudio
    Member
    Posted 5 months ago #

    Hello,

    I was able to fend for himself on this one!
    I was inspired by the plugin: ThemePerPost

    I would like to develop more this plugin.
    In my list of posts I want to choose models of apartment theme template:

    "Theme Page No. 1"
    -> Model template "Theme 1 | Go Home"

    "Theme Page 2"
    -> Model template "Theme 2 | Test Page"

    So I thought to do that change the function get_page_templates with add_filter
    For cons I do not quite see how.

    I did this to test:

    function functiontest() {
    return "test";
    }
    
    add_filter ('get_page_templates', 'functiontest', 1,1);

    But nothing happens ... anyone have an idea!
    Is that how well we use the fontion add_filter?
    The function get_page_templates filter can it be?

    Thank you very much,

Reply

You must log in to post.

About this Topic

Tags