Posted by KaiseRCrazY on 19th December 2009

Simple Sticky Posts!

Sitcky posts are best way to show your featured content. But some themes don’t support extra area for that. You can create empty area with this code. Simply usage, you can change css and codes if you want. Let’s begin…

Here is the code;

Firstly we call the extra .php file for this. You can apply this code where you want;

<?php if(is_home() !is_paged()): ?>
<?php // Featured posts go here.
include (TEMPLATEPATH . "/featured.php"); ?>
<?php endif;?>

That’s calling function and here is the page code;

Firstly create a featured.php and upload into wp-content/themes/your-theme/ .  Change category number with your featured content category number. Insert this code into file…

Code…

    <!-- start Featured -->
<?php query_posts("showposts=1&cat=6"); ?>
<?php while (have_posts()) : the_post(); ?>
<div id="featured">
<div id="featured2">
<div id="featurediv">
<div class="epic">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Continue reading <?php the_title(); ?>"><img src="<?php $values = get_post_custom_values("Thumbnail"); echo $values[0]; ?>" alt="Continue reading <?php the_title(); ?>" /></a>
</div>
<div class="etext">
<div class="ehead">
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Continue reading <?php the_title(); ?>"><?php the_title(); ?></a></h2>
<div class="entryinfo"><?php edit_post_link('Edit', '', ' |'); ?> Posted by <strong><?php the_author(); ?></strong> on <?php the_time('d M Y'); ?> under <?php the_category(', ') ?> | <?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?>
</div>
</div>
<div class="post">
<?php the_excerpt(); ?>
</div>
</div>
<div class="clearer"></div>
</div>
</div>
</div>
<?php endwhile; ?><!-- end Featured -->

That’s All!

  • del.icio.us
  • Digg
  • Facebook
  • FriendFeed
  • Reddit
  • StumbleUpon
  • Technorati
  • PDF
  • Print

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

    1 Response

  1. [...] the rest here: Simple Sticky Posts! Comments0 Leave a Reply Click here to cancel [...]

Post your comments