Using Separate Category to Hold Static Image Above Blog
-
Hey everybody!
I can’t remember how I hid the header image from my edited default Kubrick theme or if I did at all, but now I need a static header image above my blog posts. To do this, I’ve used some code that basically makes a new category into a sticky that hangs out above all my posts. Here it is:
<?php if(have_posts()) : ?> <?php $recentBlog = new WP_Query('cat=2&showposts=1'); ?> <?php while($recentBlog->have_posts()) : $recentBlog->the_post();?> <div> <?php $postimageurl = get_post_meta($post->ID, 'post-img', true); if ($postimageurl) { ?> <a href="<?php the_permalink(); ?>"><img src="<?php bloginfo('template_directory'); ?><?php echo $postimageurl; ?>" alt="<?php the_title(); ?>" /></a> <?php } ?> </div> <?php endwhile; ?> <?php else: ?> <?php endif; ?>That works perfectly (http://www.huntermadeit.com/?page_id=309), except I don’t want the date, the link to the archive for that category, or a link to it’s comments in the “post”. Although I’m harnessing the power of a blog category to hold my image, I don’t want viewers to know it’s a separate blog. Seamless, you know?
So far I’ve tried this:
-Edited my single.php file to call different templates to different categories
<?php $post = $wp_query->post; if ( in_category(’2′) ) { include(TEMPLATEPATH . ‘/wp-content/themes/default/archiveblogheader.php’); } else { include(TEMPLATEPATH . ‘/wp-content/themes/default/singlepost.php’); } ?>where “archiveblogheader.php” is a copied “archive.php” file with the call to post metadata (timestamp, archive link, view comments) deleted, but nothing is changing.
Any ideas?
The blog I need help with is: (visible only to logged in users)
-
The blog you specified at http://www.huntermadeit.com does not appear to be hosted at WordPress.com.
This support forum is for WordPress.com hosted blogs only. If you have a self-hosted WordPress blog you need to seek help at the WordPress.org forums, not here.
If you don’t understand the difference, you may find this information helpful.
- The topic ‘Using Separate Category to Hold Static Image Above Blog’ is closed to new replies.