Inject custom field into header
-
Hi
I’m using the latest post from a certain category as a home page. I’d like to load a custom field (in this case, a css file) so that the post displays correctly.
Here’s my code:
<?php $css_query = new WP_Query(); $css_query->query('category_name=mag_post&showposts=1'); while ($css_query->have_posts()) : $css_query->the_post(); ?> <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'template_url' ); ?>/css/<?php get_post_meta($post->ID, 'custom_css', true); ?>" /> <?php echo get_post_meta($post->ID, 'preview', true); ?> <?php endwhile; ?>
But it isn’t returning anything. The custom field is definitely there.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Inject custom field into header’ is closed to new replies.