Display a sticky post only


Sponsored Links






WordPress is wonderful publishing platform, there are so many query that we can tweak it. On this chapter I will show you How to display a sticky post only in our loop. All need to do only written some code below on which area you want, example display it on sidebar.php or in header.php or footer.php. Let’s get started. Open you theme files and added this code

WordPress Sticky Post Tutorial

WordPress Sticky Post Tutorial

<?php
$sticky = get_option( ’sticky_posts’ );
query_posts( array( ‘post__in’ => $sticky, ‘caller_get_posts’ => 1, ‘orderby’ => ID, ’showposts’ => 2 ) );
?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h3><a href=”<?php the_permalink(); ?>” rel=”bookmark” title=”Permanent Link to <?php the_title(); ?>”></h3>
<?php the_excerpt(); ?>
<?php endwhile;?>
<?php endif; ?>

And done, you have create WordPress Loop and only do looping on sticky post only. There are so many solution to How to display a sticky post, like some sample from Justin Tadlock, use you creatifty and enhanced this code above.

Subscribe to Full RSS Feed

RSS FeedIf you thing this article useful, please consider subscribing to our RSS Feed or e-mail updates and stay updated with us. You can also follow @WPTricksNet on twitter for latest updates.

About WP Tricks

We are WordPress Family, we collected and writed useful tips and tricks for you WordPress. We share it for you...

Related Tips and Trick from Local Data and on The Net

How To Display Ads after first Post

Using WordPress and added extra code you can create wonderful Publishing System. Right now we will show you how to display Ads (Example Google AdSense) after first post of you WordPress. How To Display Ads after first Post is quietly … Read More

Create Custom Page with Custom Loop and Query

Created WordPress as CMS? I am guarantee you'll need this tricks. Because WordPress Custom Page is Gregorius tools we can use to create custom design/layout and whatever we want. I will show you how to Create Custom Page with Custom … Read More

Tutorial To Display a Different Number of Post on Search Result

Did you know that, WordPress search result have the same number of post with original WordPress loop, you can check your setting on Settings » Reading » Blog pages show at most. But for some reason, we need to show … Read More

How To Setup Multiple Loops in WordPress

WordPress built in with many query method, our example below about query is the best way to create Multiple Loops.  I will show you how to  do multiple loops in wordpress. let us assume we want to have two lists … Read More

Style Posts From Some Category Differently

Right now, every blogger has know WordPress as easiest and nicely support publishing system. To create more sophisticated and personal blog. Blogger chooses WordPress as they Blog Engine. Some featured that we can use to create more unique blog is … Read More

How to Get Most Commented Posts with Thumbnail

There are so many way to attract visitor on your WordPress blog, the one of them is show most popular post on your sidebar or footer, beside that fact in order to help your visitors finding your best content. Let's … Read More

Display a sticky post only / WordPress Tricks & Tips

WordPress is wonderful publishing platform, there are so many query that we can tweak it. On this chapter I will show you How to display a sticky post only in our loop. read more

Source: http://wptricks.net/display-a-sticky-post-only/

How To Display Just the Sticky Post on Front Page in WordPress

Scenario. Settings -> Reading: Front page is set to display latest blog posts. Blog pages show at most set to 1. When sticky post is the latest. In this case, only read more

Source: http://sridharkatakam.com/2010/07/13/display-sticky-post-front-page-wordpress/

How to Display the Latest Sticky Posts in WordPress

WordPress has this very cool feature called stick posts. When you make a post sticky, it shows up above your new posts, but only if your theme is set to be that way. read more

Source: http://www.wpbeginner.com/wp-tutorials/how-to-display-the-latest-sticky-posts-in-wordpress/

Display only one wordpress sticky post on your homepage : Live

Display only one wordpress sticky post on your homepage,Do you use WordPress as a CMS instead of a blog? If yes, you’ll probably b read more

Source: http://www.livexp.net/wordpress/display-only-one-wordpress-sticky-post-on-your-homepage.html

Definitive Sticky Posts Guide for WordPress 2.7

I need to make a post sticky to its category only and not have it stick to the home page where I only want to display the most recent posts. When I select sticky to a read more

Source: http://www.nathanrice.net/blog/definitive-sticky-posts-guide-for-wordpress-27/


4 Responses to Display a sticky post only

  1. Pingback: wp-popular.com » Blog Archive » How To Display a sticky post only # WordPress Tricks & Tips

  2. SQL training says:

    I’m just new in using word press. I’m still learning every little bit of it. And I don’t get your code here. But I will try it and figure it out. Thank you by the way.

  3. Pingback: The Best way to replace words in your posts | Jhez3R

  4. this blog says:

    Great post. I’m a normal visitor of your blog and appreciate you taking the time to maintain the nice site. I’ll be a regular visitor for a long time.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>