<?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 Tag: return</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Sun, 26 May 2013 00:06:58 +0000</pubDate>

<item>
<title>AnotherAndrew on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23093</link>
<pubDate>Thu, 15 Sep 2011 01:46:54 +0000</pubDate>
<dc:creator>AnotherAndrew</dc:creator>
<guid isPermaLink="false">23093@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I am answering my own question for future time travelers!&#60;/p&#62;
&#60;p&#62;To use the sticky post feature, I parsed in an array into the wp query that would include the sticky post option, like so&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$args=array(
    &#38;#39;post_type&#38;#39; =&#38;gt; &#38;#39;post&#38;#39;,
    &#38;#39;post_status&#38;#39; =&#38;gt; &#38;#39;publish&#38;#39;,
    &#38;#39;post__in&#38;#39;=&#38;gt;get_option(&#38;#39;sticky_posts&#38;#39;),
    &#38;#39;category__in&#38;#39;=&#38;gt; array (10),
    &#38;#39;showposts&#38;#39; =&#38;gt; 1,
    &#38;#39;caller_get_posts&#38;#39;=&#38;gt; 1
    );

$featurednews = new WP_Query( $args );
// ETC from the code above in this discussion&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>AnotherAndrew on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23086</link>
<pubDate>Wed, 14 Sep 2011 20:37:03 +0000</pubDate>
<dc:creator>AnotherAndrew</dc:creator>
<guid isPermaLink="false">23086@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;O, wow, I did not know about this sticky post option. &#60;/p&#62;
&#60;p&#62;This is just what I was thinking about and looking for. &#60;/p&#62;
&#60;p&#62;How does that work?
&#60;/p&#62;</description>
</item>
<item>
<title>middlesister on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23085</link>
<pubDate>Wed, 14 Sep 2011 20:26:10 +0000</pubDate>
<dc:creator>middlesister</dc:creator>
<guid isPermaLink="false">23085@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Cool! Ok, good to know for the future.
&#60;/p&#62;</description>
</item>
<item>
<title>AnotherAndrew on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23084</link>
<pubDate>Wed, 14 Sep 2011 20:23:37 +0000</pubDate>
<dc:creator>AnotherAndrew</dc:creator>
<guid isPermaLink="false">23084@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;You the man. That does work. &#60;/p&#62;
&#60;p&#62;Just so you know, you do need to get rid of the last wp_reset_postdata() or else, at least in my case, I got a 403 on my admin login page.
&#60;/p&#62;</description>
</item>
<item>
<title>middlesister on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23083</link>
<pubDate>Wed, 14 Sep 2011 20:09:32 +0000</pubDate>
<dc:creator>middlesister</dc:creator>
<guid isPermaLink="false">23083@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;The post formatting don't work if you just put everything in echo like that, jump out of php to write the html like this&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
$featurednews = new WP_Query( &#38;#39;tag=featured&#38;#38;cat=10&#38;#38;posts_per_page=1&#38;#38;orderby=date&#38;#39; );
 if ( $featurednews-&#38;gt;have_posts() ) :
    while ( $featurednews-&#38;gt;have_posts()) : $featurednews-&#38;gt;the_post();
        // post formatting goes here
?&#38;gt;			&#38;lt;div class=&#38;quot;post&#38;quot; id=&#38;quot;post-&#38;lt;?php the_ID(); ?&#38;gt;&#38;quot;&#38;gt;
				&#38;lt;div class=&#38;quot;home-thumbnail&#38;quot;&#38;gt;
					&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_post_thumbnail(array(160,160))?&#38;gt;&#38;lt;/a&#38;gt;
				&#38;lt;/div&#38;gt;
				&#38;lt;div class=&#38;quot;text&#38;quot;&#38;gt;
					&#38;lt;h2&#38;gt;latest news: &#38;lt;?php the_date(&#38;#39;F j, Y&#38;#39;);?&#38;gt;&#38;lt;/h2&#38;gt;
					&#38;lt;h3&#38;gt;&#38;lt;?php the_title() ?&#38;gt;&#38;lt;/h3&#38;gt;
					&#38;lt;?php the_excerpt() ?&#38;gt;
				&#38;lt;/div&#38;gt;
			&#38;lt;/div&#38;gt;
&#38;lt;?php
    endwhile;
else :
   $fallback_news = new WP_Query( &#38;#39;cat=10&#38;#38;posts_per_page=1&#38;#38;orderby=date&#38;#39; );
    while ($fallback_news-&#38;gt;have_posts()) : $fallback_news-&#38;gt;the_post();
	// post formatting goes here
?&#38;gt;			&#38;lt;div class=&#38;quot;post&#38;quot; id=&#38;quot;post-&#38;lt;?php the_ID(); ?&#38;gt;&#38;quot;&#38;gt;
				&#38;lt;div class=&#38;quot;home-thumbnail&#38;quot;&#38;gt;
					&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_post_thumbnail(array(160,160))?&#38;gt;&#38;lt;/a&#38;gt;
				&#38;lt;/div&#38;gt;
				&#38;lt;div class=&#38;quot;text&#38;quot;&#38;gt;
					&#38;lt;h2&#38;gt;latest news: &#38;lt;?php the_date(&#38;#39;F j, Y&#38;#39;);?&#38;gt;&#38;lt;/h2&#38;gt;
					&#38;lt;h3&#38;gt;&#38;lt;?php the_title() ?&#38;gt;&#38;lt;/h3&#38;gt;
					&#38;lt;?php the_excerpt() ?&#38;gt;
				&#38;lt;/div&#38;gt;
			&#38;lt;/div&#38;gt;
&#38;lt;?php
    endwhile;
    wp_reset_postdata();
endif;
wp_reset_postdata();
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;Like I said it &#60;em&#62;ought&#60;/em&#62; to work, but I haven't tested it yet. I'll come back when I have.
&#60;/p&#62;</description>
</item>
<item>
<title>AnotherAndrew on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23080</link>
<pubDate>Wed, 14 Sep 2011 19:54:57 +0000</pubDate>
<dc:creator>AnotherAndrew</dc:creator>
<guid isPermaLink="false">23080@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Yes, I made some edits, but I'm not getting any posts to return.&#60;/p&#62;
&#60;p&#62;Here is my code&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
$featurednews = new WP_Query( &#38;#39;tag=featured&#38;#38;cat=10&#38;#38;posts_per_page=1&#38;#38;orderby=date&#38;#39; );
 if ( $featurednews-&#38;gt;have_posts() ) :
    while ( $featurednews-&#38;gt;have_posts()) : $featurednews-&#38;gt;the_post();
        // post formatting goes here
		echo &#38;#39;			&#38;lt;div class=&#38;quot;post&#38;quot; id=&#38;quot;post-&#38;lt;?php the_ID(); ?&#38;gt;&#38;quot;&#38;gt;
				&#38;lt;div class=&#38;quot;home-thumbnail&#38;quot;&#38;gt;
					&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_post_thumbnail(array(160,160))?&#38;gt;&#38;lt;/a&#38;gt;
				&#38;lt;/div&#38;gt;
				&#38;lt;div class=&#38;quot;text&#38;quot;&#38;gt;
					&#38;lt;h2&#38;gt;latest news: &#38;lt;?php the_date(\&#38;#39;F j, Y\&#38;#39;);?&#38;gt;&#38;lt;/h2&#38;gt;
					&#38;lt;h3&#38;gt;&#38;lt;?php the_title() ?&#38;gt;&#38;lt;/h3&#38;gt;
					&#38;lt;?php the_excerpt() ?&#38;gt;
				&#38;lt;/div&#38;gt;
			&#38;lt;/div&#38;gt;
&#38;#39;;
    endwhile;
else :
   $fallback_news = new WP_Query( &#38;#39;cat=10&#38;#38;posts_per_page=1&#38;#38;orderby=date&#38;#39; );
    while ($fallback_news-&#38;gt;have_posts()) : $fallback_news-&#38;gt;the_post();
	// post formatting goes here
		echo &#38;#39;			&#38;lt;div class=&#38;quot;post&#38;quot; id=&#38;quot;post-&#38;lt;?php the_ID(); ?&#38;gt;&#38;quot;&#38;gt;
				&#38;lt;div class=&#38;quot;home-thumbnail&#38;quot;&#38;gt;
					&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_post_thumbnail(array(160,160))?&#38;gt;&#38;lt;/a&#38;gt;
				&#38;lt;/div&#38;gt;
				&#38;lt;div class=&#38;quot;text&#38;quot;&#38;gt;
					&#38;lt;h2&#38;gt;latest news: &#38;lt;?php the_date(\&#38;#39;F j, Y\&#38;#39;);?&#38;gt;&#38;lt;/h2&#38;gt;
					&#38;lt;h3&#38;gt;&#38;lt;?php the_title() ?&#38;gt;&#38;lt;/h3&#38;gt;
					&#38;lt;?php the_excerpt() ?&#38;gt;
				&#38;lt;/div&#38;gt;
			&#38;lt;/div&#38;gt;
&#38;#39;;

    endwhile;
    wp_reset_postdata();
endif;
wp_reset_postdata();
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>middlesister on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23079</link>
<pubDate>Wed, 14 Sep 2011 19:19:23 +0000</pubDate>
<dc:creator>middlesister</dc:creator>
<guid isPermaLink="false">23079@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Sorry, a typo in the second while loop - its &#60;code&#62;$fallback_news&#60;/code&#62; and not &#60;code&#62;$sfallback_news&#60;/code&#62; of course.&#60;br /&#62;
Or did I miss something else?
&#60;/p&#62;</description>
</item>
<item>
<title>AnotherAndrew on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23078</link>
<pubDate>Wed, 14 Sep 2011 18:43:41 +0000</pubDate>
<dc:creator>AnotherAndrew</dc:creator>
<guid isPermaLink="false">23078@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;O, ok, thanks! That seems to make more sense.&#60;/p&#62;
&#60;p&#62;Hmm, your syntax is missing something....
&#60;/p&#62;</description>
</item>
<item>
<title>middlesister on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23073</link>
<pubDate>Wed, 14 Sep 2011 16:25:38 +0000</pubDate>
<dc:creator>middlesister</dc:creator>
<guid isPermaLink="false">23073@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Ok I see, the category is a fallback. Well try this&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;$featurednews = new WP_Query( &#38;#39;tag=featured&#38;#38;cat=10&#38;#38;posts_per_page=1&#38;#38;orderby=date&#38;#39; );
 if ( $featurednews-&#38;gt;have_posts() ) :
    while ( $featurednews-&#38;gt;have_posts()) ) : $featurednews-&#38;gt;the_post();
        // post formatting goes here
    endwhile;
else :
   $fallback_news = new WP_Query( &#38;#39;cat=10&#38;#38;posts_per_page=1&#38;#38;orderby=date&#38;#39; );
    while ($sfallback_news-&#38;gt;have_posts()) : $fallback_news-&#38;gt;the_post();
	// post formatting goes here
    endwhile;
    wp_reset_postdata();
endif;
wp_reset_postdata();&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;I haven't tried nesting things like this, but it ought to work. Maybe you don't need to use reset_postdata twice but only the second one.
&#60;/p&#62;</description>
</item>
<item>
<title>AnotherAndrew on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23072</link>
<pubDate>Wed, 14 Sep 2011 16:01:13 +0000</pubDate>
<dc:creator>AnotherAndrew</dc:creator>
<guid isPermaLink="false">23072@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;&#38;gt; Would you remove the featured tag each time you want a 'normal' category post to be displayed?&#60;/p&#62;
&#60;p&#62;No, the loop would place priority on a post with a tag of 'featured'. If no posts in the category have a tag of 'featured' then it would select the latest post.
&#60;/p&#62;</description>
</item>
<item>
<title>middlesister on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23068</link>
<pubDate>Wed, 14 Sep 2011 15:26:11 +0000</pubDate>
<dc:creator>middlesister</dc:creator>
<guid isPermaLink="false">23068@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;Well is_tag() checks whether the page is a tag archive page, so it will never be true on a category page.&#60;br /&#62;
Maybe you could try with has_tag( 'featured' ) instead?  I think it uses the current post in the loop, and if called outside the loop needs a post ID parameter has_tag( 'featured', ID).&#60;br /&#62;
I'm not sure I follow the logic of what you want to do. Would you remove the featured tag each time you want a 'normal' category post to be displayed?
&#60;/p&#62;</description>
</item>
<item>
<title>AnotherAndrew on "retireve post based on category and or tag"</title>
<link>http://themeshaper.com/forums/topic/retireve-post-based-on-category-and-or-tag#post-23062</link>
<pubDate>Wed, 14 Sep 2011 02:16:37 +0000</pubDate>
<dc:creator>AnotherAndrew</dc:creator>
<guid isPermaLink="false">23062@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;I would like to be able to retrieve a post in a category based on if it has a certain tag. &#60;/p&#62;
&#60;p&#62;Or in other words, I would like my loop to return the latest post from a certain category BUT if it has a tag of 'featured' then it would return the latest post with that tag first.&#60;/p&#62;
&#60;p&#62;If the post does not have the tag 'featured' associated, then it would return the next latest post from that category without the tag 'featured'.&#60;/p&#62;
&#60;p&#62;Maybe, ideally, the post could have a custom field for 'featured'?&#60;/p&#62;
&#60;p&#62;I am using this code but not getting the results I want. Anyone have suggestions?&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
	if (is_category(10) &#124;&#124; is_tag(&#38;#39;featured&#38;#39;)) {
	$featurednews = new WP_Query( &#38;#39;tag=featured&#38;#38;cat=10&#38;#38;posts_per_page=1&#38;#38;orderby=date&#38;#39; );
	};
	else (is_category(10) {
	$featurednews = new WP_Query( &#38;#39;cat=10&#38;#38;posts_per_page=1&#38;#38;orderby=date&#38;#39; );
	}
	while ( $featurednews-&#38;gt;have_posts() )
	{
		$featurednews-&#38;gt;the_post(); // fill $post with data
		?&#38;gt;
			&#38;lt;div class=&#38;quot;post&#38;quot; id=&#38;quot;post-&#38;lt;?php the_ID(); ?&#38;gt;&#38;quot;&#38;gt;
				&#38;lt;div class=&#38;quot;home-thumbnail&#38;quot;&#38;gt;
					&#38;lt;a href=&#38;quot;&#38;lt;?php the_permalink() ?&#38;gt;&#38;quot;&#38;gt;&#38;lt;?php the_post_thumbnail(array(160,160))?&#38;gt;&#38;lt;/a&#38;gt;
				&#38;lt;/div&#38;gt;
				&#38;lt;div class=&#38;quot;text&#38;quot;&#38;gt;
					&#38;lt;h2&#38;gt;latest news: &#38;lt;?php the_date(&#38;#39;F j, Y&#38;#39;);?&#38;gt;
&#38;lt;/h2&#38;gt;
					&#38;lt;h3&#38;gt;&#38;lt;?php the_title() ?&#38;gt;&#38;lt;/h3&#38;gt;
					&#38;lt;?php the_excerpt() ?&#38;gt;
				&#38;lt;/div&#38;gt;
			&#38;lt;/div&#38;gt;
		&#38;lt;?php
	}
	rewind_posts();
?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
</item>

</channel>
</rss>
