<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Get the latest sticky posts in WordPress</title>
	<atom:link href="http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress/feed" rel="self" type="application/rss+xml" />
	<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress</link>
	<description>Life, Blogging, and WordPress</description>
	<lastBuildDate>Fri, 10 Feb 2012 12:19:21 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Michael Spree</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-549263</link>
		<dc:creator>Michael Spree</dc:creator>
		<pubDate>Tue, 03 Jan 2012 23:14:58 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-549263</guid>
		<description>Hi, I have a simple solution to this problem. I was trying to get my sticky posts to show on a static page. I couldn&#039;t figure it out, so I made a new category called &#039;sticky&#039;, and then i simply called the most recent posts from the category.

Anything i want sticky, I just list in that category...</description>
		<content:encoded><![CDATA[<p>Hi, I have a simple solution to this problem. I was trying to get my sticky posts to show on a static page. I couldn&#8217;t figure it out, so I made a new category called &#8216;sticky&#8217;, and then i simply called the most recent posts from the category.</p>
<p>Anything i want sticky, I just list in that category&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-471134</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Mon, 07 Nov 2011 18:59:34 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-471134</guid>
		<description>Like I said, an amateur. Maybe code will appear this time...

&lt;pre&gt;&lt;code&gt;// select posts that have been manually chosen to appear at top of homepage (HP)
// - user chooses posts to appear by setting post_order
		
$hpsql = &#039;SELECT `P`.* , `M`.`meta_value` AS `post_order`;
$hpsql .= &#039;FROM `wp_posts` AS `P`&#039;;
$hpsql .= &#039;JOIN `wp_postmeta` AS `M` ON ( `M`.`post_id` = `P`.`ID`&#039;;
$hpsql .= &#039;AND `M`.`meta_key` = &quot;post_order&quot; )&#039;;
$hpsql .= &#039;WHERE `P`.`post_status` = &quot;publish&quot;&#039;;
$hpsql .= &#039;ORDER BY `post_order` ASC&#039;;
		
$hposts= $wpdb-&gt;get_results($hpsql);

foreach ($hposts as $post) : setup_postdata($post);
	$ord = $post-&gt;post_order;

endforeach;&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Like I said, an amateur. Maybe code will appear this time&#8230;</p>
<pre><code>// select posts that have been manually chosen to appear at top of homepage (HP)
// - user chooses posts to appear by setting post_order

$hpsql = 'SELECT `P`.* , `M`.`meta_value` AS `post_order`;
$hpsql .= 'FROM `wp_posts` AS `P`';
$hpsql .= 'JOIN `wp_postmeta` AS `M` ON ( `M`.`post_id` = `P`.`ID`';
$hpsql .= 'AND `M`.`meta_key` = "post_order" )';
$hpsql .= 'WHERE `P`.`post_status` = "publish"';
$hpsql .= 'ORDER BY `post_order` ASC';

$hposts= $wpdb-&gt;get_results($hpsql);

foreach ($hposts as $post) : setup_postdata($post);
	$ord = $post-&gt;post_order;

endforeach;</code></pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jon</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-471133</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Mon, 07 Nov 2011 18:54:40 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-471133</guid>
		<description>I decided I wanted a bunch of sticky posts instead of a &#039;sticky&#039; category because it seemed intuitively right but then got in a mess because my new stickified posts would appear in an undesired order, i.e. ascending ID:

** Even where orderby was set in query_posts() parameters **
(I don&#039;t think all users experience this; I did.)

I needed to order my homepage posts by a custom &#039;meta&#039; variable and ended up writing some SQL to do it, so it&#039;s kind of irrelevant that they are sticky, except that the stickiness caused the problem. So this code turns out to be more about working with the wordpress database... anyway here it is:

&lt;pre&gt;&lt;code&gt;get_results($hpsql);

	foreach ($hposts as $post) : setup_postdata($post);
		$play = $post-&gt;play_link;
		$ord = $post-&gt;post_order;

	?&gt;&lt;/code&gt;&lt;/pre&gt;

Comments welcome! (I&#039;m very amateur at all this.)
Jon</description>
		<content:encoded><![CDATA[<p>I decided I wanted a bunch of sticky posts instead of a &#8216;sticky&#8217; category because it seemed intuitively right but then got in a mess because my new stickified posts would appear in an undesired order, i.e. ascending ID:</p>
<p>** Even where orderby was set in query_posts() parameters **<br />
(I don&#8217;t think all users experience this; I did.)</p>
<p>I needed to order my homepage posts by a custom &#8216;meta&#8217; variable and ended up writing some SQL to do it, so it&#8217;s kind of irrelevant that they are sticky, except that the stickiness caused the problem. So this code turns out to be more about working with the wordpress database&#8230; anyway here it is:</p>
<pre><code>get_results($hpsql);

	foreach ($hposts as $post) : setup_postdata($post);
		$play = $post-&gt;play_link;
		$ord = $post-&gt;post_order;

	?&gt;</code></pre>
<p>Comments welcome! (I&#8217;m very amateur at all this.)<br />
Jon</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Display Latest Sticky Posts in WordPress &#124; Tutorial</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-452373</link>
		<dc:creator>Display Latest Sticky Posts in WordPress &#124; Tutorial</dc:creator>
		<pubDate>Wed, 19 Oct 2011 17:22:22 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-452373</guid>
		<description>[...] credit to this code goes to Justin Tadlock and partially to Nathan Rice for coming up with the array slice solution.   This entry was posted [...]</description>
		<content:encoded><![CDATA[<p>[...] credit to this code goes to Justin Tadlock and partially to Nathan Rice for coming up with the array slice solution.   This entry was posted [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 10 Useful WordPress Loop Hacks - Smashing Magazine &#124; Smashing Magazine</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-424023</link>
		<dc:creator>10 Useful WordPress Loop Hacks - Smashing Magazine &#124; Smashing Magazine</dc:creator>
		<pubDate>Mon, 19 Sep 2011 15:20:09 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-424023</guid>
		<description>[...] Get the latest sticky posts in WordPress [...]</description>
		<content:encoded><![CDATA[<p>[...] Get the latest sticky posts in WordPress [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WordPress: Sticky Posts On Static Front Page &#124; Ipstenu on Tech</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-418744</link>
		<dc:creator>WordPress: Sticky Posts On Static Front Page &#124; Ipstenu on Tech</dc:creator>
		<pubDate>Mon, 12 Sep 2011 20:29:58 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-418744</guid>
		<description>[...] instead I added a special loop that runs at the top:&lt;  From Justin Tadlock we get the very helpful Get the latest sticky posts in WordPress which I used to show the first (and only) sticky. Obviously change the 1 to the number of stickies [...]</description>
		<content:encoded><![CDATA[<p>[...] instead I added a special loop that runs at the top:&lt;  From Justin Tadlock we get the very helpful Get the latest sticky posts in WordPress which I used to show the first (and only) sticky. Obviously change the 1 to the number of stickies [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bilal Ahmed</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-358483</link>
		<dc:creator>Bilal Ahmed</dc:creator>
		<pubDate>Mon, 13 Jun 2011 20:14:54 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-358483</guid>
		<description>[...] 15. Get The Latest Sticky Posts [...]</description>
		<content:encoded><![CDATA[<p>[...] 15. Get The Latest Sticky Posts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mahesh</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-346287</link>
		<dc:creator>Mahesh</dc:creator>
		<pubDate>Thu, 26 May 2011 08:44:16 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-346287</guid>
		<description>Hello, I want to know, How to separate Sticky posts than other posts on Homepage? Like, www.labnol.org, it shows the sticky post with thumbnail and other posts without thumbnail on homepage.</description>
		<content:encoded><![CDATA[<p>Hello, I want to know, How to separate Sticky posts than other posts on Homepage? Like, <a href="http://www.labnol.org" rel="nofollow">http://www.labnol.org</a>, it shows the sticky post with thumbnail and other posts without thumbnail on homepage.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 23 Excellent Tutorials For WordPress Theme Developers &#124; WebScriptPlus.com</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-299290</link>
		<dc:creator>23 Excellent Tutorials For WordPress Theme Developers &#124; WebScriptPlus.com</dc:creator>
		<pubDate>Tue, 22 Feb 2011 11:59:12 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-299290</guid>
		<description>[...] 15. Get The Latest Sticky Posts [...]</description>
		<content:encoded><![CDATA[<p>[...] 15. Get The Latest Sticky Posts [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ryanve</title>
		<link>http://justintadlock.com/archives/2009/03/28/get-the-latest-sticky-posts-in-wordpress#comment-283174</link>
		<dc:creator>ryanve</dc:creator>
		<pubDate>Sat, 22 Jan 2011 03:10:06 +0000</pubDate>
		<guid isPermaLink="false">http://justintadlock.com/?p=1566#comment-283174</guid>
		<description>whoa I figured it out—answered my own question above about how to do it with &lt;code&gt;get_posts()&lt;/code&gt;. The code below show the most recent sticky post from category id=4. In this case it shows the thumbnail only but one can edit the html part as needed. I&#039;m using it on a homepage to show the most recent sticky post in 3 categories.

&lt;pre&gt;&lt;code&gt;&lt;?php
global $post;
$args = array( &#039;numberposts&#039; =&gt; 1, &#039;offset&#039; =&gt; 0, &#039;category&#039; =&gt; 4, &#039;include&#039;  =&gt; get_option( &#039;sticky_posts&#039; ) );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :	setup_postdata($post); ?&gt;
	&lt;div class=&quot;&lt;?php hybrid_entry_class(); ?&gt;&quot;&gt;&lt;?php get_the_image( array( &#039;custom_key&#039; =&gt; array( &#039;Thumbnail&#039; ), &#039;size&#039; =&gt; &#039;thumbnail&#039; ) ); ?&gt;&lt;/div&gt;&lt;!--.hentry--&gt;
&lt;?php endforeach; ?&gt;&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>whoa I figured it out—answered my own question above about how to do it with <code>get_posts()</code>. The code below show the most recent sticky post from category id=4. In this case it shows the thumbnail only but one can edit the html part as needed. I&#8217;m using it on a homepage to show the most recent sticky post in 3 categories.</p>
<pre><code>&lt;?php
global $post;
$args = array( 'numberposts' =&gt; 1, 'offset' =&gt; 0, 'category' =&gt; 4, 'include'  =&gt; get_option( 'sticky_posts' ) );
$myposts = get_posts( $args );
foreach( $myposts as $post ) :	setup_postdata($post); ?&gt;
	&lt;div class="&lt;?php hybrid_entry_class(); ?&gt;"&gt;&lt;?php get_the_image( array( 'custom_key' =&gt; array( 'Thumbnail' ), 'size' =&gt; 'thumbnail' ) ); ?&gt;&lt;/div&gt;&lt;!--.hentry--&gt;
&lt;?php endforeach; ?&gt;</code></pre>
]]></content:encoded>
	</item>
</channel>
</rss>

