[wp-hackers] how to apply a theme only for a page

Khaleel Abdul Karim webmaster887 at gmail.com
Thu Apr 22 10:47:29 UTC 2010


Can anyone please help me how to load a specific template and stylesheet for
a particular page through code . i have designed a solution in this way
add_action('the_post','show_theme');
function show_theme($post)
{
    $postid=$post->ID;
    if($sel_theme=get_post_meta($postid,'theme', true))
    {
        $theme_data=get_theme($sel_theme);
        $template=$theme_data['Template'];
        $stylesheet=$theme_data['Stylesheet'];
         //code to display the page in the specific theme
    }
}
Can i use any other action hook other than 'the_post'?
and this code should not change the admin selected theme
i found the similar feature in a plugin *headspace2 *(page specific theme
feature)

*http://wordpress.org/extend/plugins/headspace2/*
Anyone please help . i 'm on this for many days ..
But i need to make a simple plugin for this.

On Thu, Apr 22, 2010 at 2:22 PM, Khaleel Abdul Karim <webmaster887 at gmail.com
> wrote:

> but the problems i have made this as a plugin..
> i have coded the apply theme in 'the_post' action hook..
> the theme will be fetched from post_meta to apply .. Thanks for all your
> contribution ,...
>
> On Thu, Apr 22, 2010 at 7:08 AM, Joaquin Rodriguez Montero <
> yojoaquin at gmail.com> wrote:
>
>> Why don't you use conditionals?
>>
>> <?php if (is_page('different')) { get_header('alt'); } else {
>> get_header();
>> } ?>
>>
>> <div id="page" class="<?php if (is_page('different')) { echo
>> 'new-template-class'; } else { echo'regular-template';  } ?>
>>
>> <?php if (is_page('different')) { get_footer('alt'); } else {
>> get_footer();
>> } ?>
>>
>> Chocks
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> ~~~~~~~~~~~~~~~~~~
> http://khaleel.isgreat.org
> Khaleel Abdul Karim
> Thazhathuveedu
> Erumely
>



-- 
~~~~~~~~~~~~~~~~~~
http://khaleel.isgreat.org
Khaleel Abdul Karim
Thazhathuveedu
Erumely


More information about the wp-hackers mailing list