<?xml version="1.0" encoding="UTF-8"?><!-- generator="bbPress" -->

<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
>

<channel>
<title>ThemeShaper Forums Topic: Create post list grouped by tag</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Wed, 22 May 2013 08:26:05 +0000</pubDate>

<item>
<title>bronwyn on "Create post list grouped by tag"</title>
<link>http://themeshaper.com/forums/topic/create-post-list-grouped-by-tag#post-12366</link>
<pubDate>Thu, 13 May 2010 16:52:27 +0000</pubDate>
<dc:creator>bronwyn</dc:creator>
<guid isPermaLink="false">12366@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Please disregard previous post; the code got broken during pasting. &#60;/p&#62;
&#60;p&#62;Code that actually works is posted over at &#60;a href=&#34;http://wordpress.pastebin.com/zavDfaqZ&#34;&#62;http://wordpress.pastebin.com/zavDfaqZ&#60;/a&#62;.
&#60;/p&#62;</description>
</item>
<item>
<title>bronwyn on "Create post list grouped by tag"</title>
<link>http://themeshaper.com/forums/topic/create-post-list-grouped-by-tag#post-12365</link>
<pubDate>Thu, 13 May 2010 15:40:47 +0000</pubDate>
<dc:creator>bronwyn</dc:creator>
<guid isPermaLink="false">12365@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;The problem is solved thanks to the kindness of alchymyth over on the Wordpress forums. In case anyone else wants to know how it is done, it goes like this:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
// get the tag list&#60;br /&#62;
$taglist = get_terms('post_tag', 'hierarchical=0&#38;#38;orderby=name&#38;#38;hide_empty=1');&#60;br /&#62;
// iterate through the tag list&#60;br /&#62;
foreach ($taglist as $pftag)&#60;br /&#62;
{&#60;br /&#62;
	//get 2 posts belonging to the tag -- ONLY the slug works to filter by tag&#60;br /&#62;
	query_posts('tag='.$pftag-&#38;gt;slug.'&#38;#38;posts_per_page=2&#38;#38;orderby=date');?&#38;gt;&#60;br /&#62;
	// make a linked heading with the tag name&#60;br /&#62;
	&#38;lt;h3&#38;gt;&#60;a&#62;slug); ?&#38;gt;&#34;&#38;gt;&#38;lt;?php echo($pftag-&#38;gt;name); ?&#38;gt;&#60;/a&#62;&#38;lt;/h3&#38;gt;&#60;br /&#62;
	// make the actual loop for the posts, which outputs them using a custom action, because I use this format many places&#60;br /&#62;
	&#38;lt;?php while (have_posts()) : the_post();&#60;br /&#62;
		purplefrog_excerpt_tile();&#60;br /&#62;
		endwhile;&#60;br /&#62;
}&#60;br /&#62;
&#60;/code&#62;
&#60;/p&#62;</description>
</item>
<item>
<title>bronwyn on "Create post list grouped by tag"</title>
<link>http://themeshaper.com/forums/topic/create-post-list-grouped-by-tag#post-12362</link>
<pubDate>Thu, 13 May 2010 06:35:38 +0000</pubDate>
<dc:creator>bronwyn</dc:creator>
<guid isPermaLink="false">12362@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I am trying to make a custom loop to do this:&#60;/p&#62;
&#60;p&#62;&#60;strong&#62;Tag Name 1&#60;/strong&#62;&#60;br /&#62;
post 1&#60;br /&#62;
post 2&#60;br /&#62;
&#60;strong&#62;Tag Name 2&#60;/strong&#62;&#60;br /&#62;
post A&#60;br /&#62;
post B&#60;/p&#62;
&#60;p&#62;For each tag, I want to have a tag name header (linked to the tag archive page) and then two posts.&#60;/p&#62;
&#60;p&#62;I have been trying to use this code:&#60;/p&#62;
&#60;p&#62;&#60;code&#62;&#60;br /&#62;
$taglist = get_terms('post_tag', 'hierarchical=0&#38;#38;orderby=name&#38;#38;hide_empty=1'); foreach ($taglist as $pftag) {&#60;br /&#62;
query_posts(&#34;tag_id=$pftag-&#38;gt;term_ID&#38;#38;posts_per_page=2&#38;#38;orderby=date&#34;);?&#38;gt;&#60;br /&#62;
&#38;lt;h3&#38;gt;&#38;lt;?php print_r($pftag-&#38;gt;name); ?&#38;gt;&#38;lt;/h3&#38;gt;&#60;br /&#62;
&#38;lt;?php while (have_posts()) : the_post();&#60;br /&#62;
purplefrog_excerpt_tile();&#60;br /&#62;
endwhile; }&#60;br /&#62;
&#60;/code&#62;&#60;/p&#62;
&#60;p&#62;The posts returned by query_posts are not filtered by tag at all. It just pops up the most recent 2 posts over and over. What am I doing wrong, and why is this so %$#^ing hard? I've been working on this for about 4 hours with very little progress, even though I got the categories version of this working much faster.&#60;/p&#62;
&#60;p&#62;The print_r for the tag name header is messy, but I haven't found anything else that actually outputs the tag name for *all* entries...
&#60;/p&#62;</description>
</item>

</channel>
</rss>
