Quantcast
Viewing all articles
Browse latest Browse all 20145

Reply To: [Assigned] Out put post-specific custom field data in sidebar

Well, I think I solved the problem…

In my sidebar, above the Types custom fields, I have a shortcode that pulls in three featured images from a particular custom post type. Turns out I needed to add wp_reset_postdata(); to the end of that function, then move the sidebar query to directly above the Types custom fields. New code looks like this:

<hr>
<a class="more" href="#">View More Impact Stories</a>
<hr>
<div class="featured-strip">
[sidebar-posts-featured-img-caption type="impact-story" qty="3"]
</div>
<?php // display custom fields
global $wp_query;
$postid = $wp_query->post->ID;
?>
<!--[wpv-post-id]-->
[wpv-if donate_text="wpcf-donate-text" evaluate="!empty($donate_text)"]<strong>
[types field="donate-text" class="" style=""][/types]
[/wpv-if]
[wpv-if donate_url="wpcf-donate-button-url" evaluate="!empty($donate_url)"]
<a href='[types field="donate-button-url" raw="true"][/types]'>[types field="donate-button-title" class="" style=""][/types]</a>
[/wpv-if]
<hr>

Hope this helps someone.


Viewing all articles
Browse latest Browse all 20145

Trending Articles