• Jan K.

    (@90jkrug)


    hi,

    i am trying to write a little plugin which allows me to add a different theme to each page. well.. still trying.. πŸ˜‰

    http://pastebin.com/dP1GH43E

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Jan K.

    (@90jkrug)

    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
    Jan

    Thread Starter Jan K.

    (@90jkrug)

    this:

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

    returns:
    NO-ID, NO-ID, NO-ID, NO-ID, NO-ID, NO-ID, NO-ID, cuttlefish, cuttlefish,

    Thread Starter Jan K.

    (@90jkrug)

    I finally made my plugin work.. πŸ™‚
    Code: http://pastebin.com/0qrBE8uh

    BUT:
    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?

    esmi

    (@esmi)

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

    Thread Starter Jan K.

    (@90jkrug)

    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? πŸ™‚

    EDIT:
    writing $page_theme = ‘twenty_ten’; works.. :S

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘WordPress Page Theme Plugin’ is closed to new replies.