WordPress Page Theme Plugin (6 posts)

  1. Jan K.
    Posted 3 years ago #


    i am trying to write a little plugin which allows me to add a different theme to each page. well.. still trying.. ;)


    The last function is the problem.
    When i put return 'mytesttheme'; at the end it works just perfect!

    when i write echo $page_theme.', '; before the return, it outputs: , , , mytesttheme, mytesttheme, mytesttheme, mytesttheme,

    in wp-backend it shows "mytesttheme" as post meta content in wp-core post meta content box.. so the saving works as it should..

    Any ideas? :S

  2. Jan K.
    Posted 3 years ago #

    when i add an ID ($page_theme = get_post_meta('66' [...]) it works..

    1. how do i get the correct ID into my plugin?
    2. how can i make some of my function only load in frontend?

    thanks a lot

  3. Jan K.
    Posted 3 years ago #


    global $wp_query;
    $postid = $wp_query->post->ID;
    if ($postid == '') :
    	echo 'NO-ID, ';
    else :
    	echo get_post_meta($postid, 'page_theme', true) .', ';

    NO-ID, NO-ID, NO-ID, NO-ID, NO-ID, NO-ID, NO-ID, cuttlefish, cuttlefish,

  4. Jan K.
    Posted 3 years ago #

    I finally made my plugin work.. :)
    Code: http://pastebin.com/0qrBE8uh

    When there is no post-meta i just want to return the current theme folder.
    $page_theme = get_current_theme(); returns the whole path.

    How do i only get the current theme folders name?

  5. esmi
    Forum Moderator
    Posted 3 years ago #

    Why not just use get_stylesheet_directory() and work from there?

  6. Jan K.
    Posted 3 years ago #

    Thanks 4 tryin to help, but when i replace line 70 with this:
    $url = get_stylesheet_directory();
    $page_theme = substr( $url, strrpos($url, '/')+1 );

    I get an server error message..

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.

    Any ideas why?
    Could someone maybe try this plugin on his/her server? :)

    writing $page_theme = 'twenty_ten'; works.. :S

Topic Closed

This topic has been closed to new replies.

About this Topic