[wp-hackers] how to apply a theme only for a page
Khaleel Abdul Karim
webmaster887 at gmail.com
Fri Apr 23 12:15:44 UTC 2010
Anyone please help me over this to find a solution ...
On Thu, Apr 22, 2010 at 7:09 PM, Khaleel Abdul Karim <webmaster887 at gmail.com
> wrote:
> I have found this code
> add_filter('template', 'get_custom_post_template');
> add_filter('stylesheet', 'get_post_stylesheet');
> function get_custom_post_template($template)
> {
> global $post;
> $sel_theme = get_post_meta($post->ID, 'theme', true);
> if(!empty($sel_theme))
>
> {
> $theme_data=get_theme($sel_theme);
> $template = $theme_data['Template'];
> }
> return $template;
> }
>
>
> function get_post_stylesheet($stylesheet)
> {
> global $post;
> $sel_theme = get_post_meta($post->ID, 'theme', true);
> if(!empty($sel_theme))
>
> {
> $theme_data=get_theme($sel_theme);
> $stylesheet = $theme_data['Stylesheet'];
> }
> return $stylesheet;
> }
>
> but still there 's some problem with it ,, i think the page template is not
> loading ... could you please help me ..
> ?
>
>
> On Thu, Apr 22, 2010 at 6:40 PM, Ash Goodman <ash at thinkinginvain.com>wrote:
>
>> I would assign the page or post a meta value using a custom field. Then
>> load
>> the appropriate style sheet using conditionals.
>>
>> <?php $your-custom-field = get_post_meta($post->ID, 'your-custom-field',
>> true); if ($your-custom-field) { ?>
>> <!-- load your new style sheet -->
>> <link rel="stylesheet" href="path to your style sheet" type="text/css"
>> media="screen" />
>> <?php } else { ?>
>> <!-- load regular style sheet -->
>> <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>"
>> type="text/css" media="screen" />
>> <?php } ?>
>> _______________________________________________
>> 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