I put together a Content Template for showing individual events of a concert calendar. Works very nicely until I insert wpv-post-body into the template.
As soon as I do, the single page only outputs the posts "the_content" but now custom fields.
Fails with Thesis theme, works with TwentyEleven. I manually removed all content filters of Thesis, but with no change of behavior.
For testing I pasted in a standard loop of wordpress.org but also some crippled output.
Found a workaround / hack by disabling the code for applying view templates to post content:
inc/wpv-shortcodes.php
<code>
/**
* Views-Shortcode: wpv-post-body
*
* Description: Display the content of the current post
*
* Parameters:
* This takes no parameters.
*
*/
function wpv_shortcode_wpv_post_body($atts){
extract(
shortcode_atts( array(), $atts )
);
$out = '';
/*
global $post;
if (isset($atts['view_template'])) {
$post->view_template_override = $atts['view_template'];
}
if(!empty($post) && $post->post_type != 'view' && $post->post_type != 'view-template'){
$out .= apply_filters('the_content', $post->post_content);
}
*/
$out = get_the_content();
return $out;
}
</code>
Perhaps the $post variable doesn't work as usually with Thesis (I remember something like this). As I see no need for applying a second template to the post, it solves the issue more or less right now.
Still crappy workaround, but at least my diy-fix works now 😉
function wpv_shortcode_wpv_post_body($atts){
extract(
shortcode_atts( array(), $atts )
);
$out = '';
if (!is_page()) {
$out = wpautop(wptexturize(get_the_content()));
} else {
global $post;
if (isset($atts['view_template'])) {
$post->view_template_override = $atts['view_template'];
}
if(!empty($post) && $post->post_type != 'view' && $post->post_type != 'view-template'){
$out .= apply_filters('the_content', $post->post_content);
}
}
return $out;
}
We've found the bug and it'll be fixed in the next release.
Can someone please confirm whether this has been fixed? I'm having a similar issue, where none of the wpv- shortcodes are working and where I'm using mostly wpv shortcodes in one of my view templates, nothing except the post content is being displayed. I can happily provide an admin login to the test site if need be.
Here is the test site:
hidden link
My "Our Products" view template looks like this:
<h2>[wpv-post-title]</h2>
<strong class="price">[wp_eStore_product_details id=[types field="product-id" format="FIELD_VALUE"][/types] info="price"]</strong>
<ul class="list-reset product-meta">
<li class="product-version">Version: <strong>[types field="version" class="" style=""][/types]</strong></li>
<li class="product-version">Works on: <strong>Headway [types field="headway-version"][/types]</strong></li>
</ul>
<img class="icon" title="Product Icon" src="[types field="product-icon" alt="icon" raw="true" title="Product Icon" size="full" align="none" class="icon"][/types]" alt="[wpv-post-title]" align="none" border="0" />
<div class="description">[wpv-post-body view_template="None" raw="true"]</div>
[wpv-if price="wpcf-price" evaluate="$price = 0"]
[wp_eStore_download_now_button id=2]
<span class="demo-wrap">or view <a class="demo" href="[types field="demo-url" raw="true"][/types]">a screenshot</a></span>
[/wpv-if]
[wpv-if price="wpcf-price" evaluate="$price > 0"]
[wp_eStore_buy_now_button id=[types field="product-id" format="FIELD_VALUE"][/types]]
<span class="demo-wrap">or try <a class="demo" href="[types field="demo-url" raw="true"][/types]">the demo</a></span>
[/wpv-if]
As you can see in this one, all the custom fields except the wpv-title one.
My blog view template looks like this:
<h3>[wpv-post-title]</h3>
<p>[wpv-post-excerpt]</p>
[wpv-post-featured-image]
<ul class="list-reset floated-list tip-meta">
<li class="tip-type">[wpv-post-taxonomy type="tips" separator="" format="link" show="name"]</li>
<li class="difficulty">[wpv-post-taxonomy type="difficulty" separator=", " format="link" show="name"]</li>
</ul>
My tips and tricks view template looks like this:
<h3>[wpv-post-title]</h3>
<p>[wpv-post-excerpt]</p>
[wpv-post-featured-image]
<ul class="list-reset floated-list tip-meta">
<li class="tip-type">[wpv-post-taxonomy type="tips" separator="" format="link" show="name"]</li>
<li class="difficulty">[wpv-post-taxonomy type="difficulty" separator="" format="link" show="name"]</li>
</ul>
Managed to figure out the issue. It was my custom code in the View/Edit Meta HTML which I hadn't update. All working fine now 🙂