<?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: wp_reset_query and meta data for the blog template</title>
<link>http://themeshaper.com/forums/</link>
<description>Help In Shaping WordPress Themes</description>
<language>en</language>
<pubDate>Wed, 22 May 2013 04:53:38 +0000</pubDate>

<item>
<title>helgatheviking on "wp_reset_query and meta data for the blog template"</title>
<link>http://themeshaper.com/forums/topic/wp_reset_query-and-meta-data-for-the-blog-template#post-19437</link>
<pubDate>Tue, 01 Mar 2011 16:26:21 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">19437@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;the meta data was being pulled from posts in the blog loop.  eventually fixed this by cloning the original query, and then restoring it at the end of the embedded loop as well as using wp_reset_postdata()&#60;/p&#62;
&#60;p&#62;here is my new blog template:&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;&#38;lt;?php
/**
 * Template Name: Blog
 *
 * This template allows you to display the latest posts on any page of the site.
 *
 */

    // calling the header.php
    get_header();

    // action hook for placing content above #container
    thematic_abovecontainer();

?&#38;gt;

		&#38;lt;div id=&#38;quot;container&#38;quot;&#38;gt;

			&#38;lt;?php thematic_abovecontent();

			echo apply_filters( &#38;#39;thematic_open_id_content&#38;#39;, &#38;#39;&#38;lt;div id=&#38;quot;content&#38;quot;&#38;gt;&#38;#39; . &#38;quot;\n&#38;quot; );

			//change query
			$temp = clone $wp_query;
			$wp_query= null;
			$wp_query = new WP_Query();
			$wp_query-&#38;gt;query( array( &#38;#39;posts_per_page&#38;#39; =&#38;gt; get_option( &#38;#39;posts_per_page&#38;#39; ), &#38;#39;paged&#38;#39; =&#38;gt; $paged ) );
			$more = 0;

				// create the navigation above the content
            	thematic_navigation_above();

            	// calling the widget area &#38;#39;index-top&#38;#39;
            	get_sidebar(&#38;#39;index-top&#38;#39;);

            	// action hook for placing content above the index loop
            	thematic_above_indexloop();

            	// action hook creating the index loop
            	thematic_indexloop();

            	// action hook for placing content below the index loop
            	thematic_below_indexloop();

            	// calling the widget area &#38;#39;index-bottom&#38;#39;
            	get_sidebar(&#38;#39;index-bottom&#38;#39;);

            	// create the navigation below the content
            	thematic_navigation_below();

            	?&#38;gt;

			&#38;lt;/div&#38;gt;&#38;lt;!-- #content --&#38;gt;

			&#38;lt;?php //reset query and post data
			$wp_query = null; $wp_query = clone $temp; wp_reset_postdata(); ?&#38;gt;

			&#38;lt;?php thematic_belowcontent(); ?&#38;gt; 

		&#38;lt;/div&#38;gt;&#38;lt;!-- #container --&#38;gt;

&#38;lt;?php 

    // action hook for placing content below #container
    thematic_belowcontainer();

    // calling the standard sidebar
    thematic_sidebar();

    // calling footer.php
    get_footer();

?&#38;gt;&#60;/code&#62;&#60;/pre&#62;</description>
</item>
<item>
<title>helgatheviking on "wp_reset_query and meta data for the blog template"</title>
<link>http://themeshaper.com/forums/topic/wp_reset_query-and-meta-data-for-the-blog-template#post-19433</link>
<pubDate>Tue, 01 Mar 2011 12:41:58 +0000</pubDate>
<dc:creator>helgatheviking</dc:creator>
<guid isPermaLink="false">19433@http://themeshaper.com/forums/</guid>
<description>&#60;p&#62;i'm trying to conditionally kill the sidebar based on meta data.  seems to work brilliantly everywhere &#60;em&#62;except&#60;/em&#62; with the blog template.  if you take a look at the blog template it has the same call:&#60;/p&#62;
&#60;p&#62;// calling the standard sidebar&#60;br /&#62;
    thematic_sidebar();&#60;/p&#62;
&#60;p&#62;as every other template so i can't figure out why my filter would not work on this page.  &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;//will turn off sidebar if layout is set to fullwidth
function kia_kill_sidebar(){
	global $layout_metabox;
	$layout_metabox-&#38;gt;the_meta();
	$layout_meta = $layout_metabox-&#38;gt;get_the_value(&#38;#39;layout&#38;#39;);

	if (&#38;quot;full&#38;quot; == $layout_meta) {
		return FALSE;
	} else {
		return TRUE;
	}

}
add_filter(&#38;#39;thematic_sidebar&#38;#39;,&#38;#39;kia_kill_sidebar&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;i realize that this function is dependent on WPAlchemy... but that side is working properly as the above works on other templates... AND the following test function shows the correct values and passes properly through the same conditional.  &#60;/p&#62;
&#60;pre&#62;&#60;code&#62;function bacon(){
	global $layout_metabox;
	$layout_metabox-&#38;gt;the_meta();

	$layout_metabox-&#38;gt;the_value(&#38;#39;layout&#38;#39;);

	echo &#38;quot;&#38;lt;p&#38;gt;&#38;lt;/p&#38;gt;&#38;quot;;

	$layout_meta = $layout_metabox-&#38;gt;get_the_value(&#38;#39;layout&#38;#39;);

	 if (&#38;quot;full&#38;quot; == $layout_meta) {
		echo &#38;quot;yay&#38;quot;;
	} else {
		echo &#38;quot;wtf&#38;quot;;
	}

}
add_action(&#38;#39;thematic_belowheader&#38;#39;,&#38;#39;bacon&#38;#39;);&#60;/code&#62;&#60;/pre&#62;
&#60;p&#62;however, it DOES work if i remove the conditionals and just return false- so i suspect it has to do with not &#60;em&#62;yet&#60;/em&#62; having a value or the meta somehow getting messed up w/ the index loop?  i've tried copying the blog template into my directory and adding wp_reset_query() b/c i have managed to track down that my first function above is pulling the meta data from the first post in the blog template, but that didn't get me anywhere.  &#60;/p&#62;
&#60;p&#62;any ideas?
&#60;/p&#62;</description>
</item>

</channel>
</rss>
