21 posts
  • Has been part of the Envato Community for over 4 years
  • Sells items exclusively on Envato Market
  • Located in United States
Wex says
<?php if( get_post_meta($post?>ID, ‘style’, true) == ‘alternative’ ){ ?>

Reaper made a small typo it should be $post->ID.

However I don’t think this is the best way to go about this. As this code does not make sense for the homepage for example.

You can try using is_single() or is_page() conditional tags if you know the id of the post you want to style differently

something like
if(is_single('id')){?>
  <link href="<?php bloginfo('template_directory'); ?>/alternative.css" rel="stylesheet" type="text/css" />
<?php }else{?>
  <link href="<?php bloginfo('template_directory'); ?>/style.css" rel="stylesheet" type="text/css" />
<?php }?>
Is there a custom field I need to put in the page that I’m assigning a different style sheet for this?

Not with that bit of code. I think your problem would actually be fixed perfectly with Reaper-Media’s solution, which he seems to have updated: http://themeforest.net/forums/thread/how-do-i-assign-a-specific-style-sheet-to-one-of-my-worpress-pages/28183?page=1#263432

His does require that you add a custom field, but it’s all explained in his post.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by