Hi Shekhar,
Thanks for your response! We've implemented the code that you've mentioned, however, we're still getting HTML outputted.
Perhaps it might be useful to explain what we want to accomplish:
1) Use a nested View with Taxonomies, to get 'Child Taxonomy' Values. We have a hierarchical taxonomy (let's call it 'MyTaxo'), such as:
- Parent 1
- Child 1
- Child 2
- Parent 2
- Child 3
- Child 4
Our 'parent' taxonomy view, 'Taxonomy Child Wrapper':
Filters =
Taxonomy parent filter: Select taxonomy terms whose parent is None.
Taxonomy term filter: Taxonomy is set by the current page
[wpv-layout-start]
[wpv-items-found]<wpv-loop>[wpv-view name="Taxonomy Child"]</wpv-loop>[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
Our 'child' taxonomy view, 'Taxonomy Child':
Filters =
Taxonomy parent filter: Select taxonomy terms whose parent is the value set by the parent view.
Taxonomy term filter: Taxonomy is set by the current page
[wpv-layout-start][wpv-items-found]<wpv-loop>[wpv-taxonomy-title]</wpv-loop>[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
2) Use the ouput of that nested view as a parameter using 'Third-party shortcode arguments:'
[wpv-view name="My Listing View" wpvparenttaxo="[child_taxo_mytaxo]"]
Our shortcode:
/* Toolset: Remove HTML wrapper:
================================================== */
function without_html($out) {
$start = strpos( $out, '<!-- wpv-loop-start -->' );
if ($start !== false && strrpos( $out, '<!-- wpv-loop-end -->', $start ) !== false) {
$start = $start + strlen( '<!-- wpv-loop-start -->' );
$out = substr( $out , $start );
$end = strrpos( $out, '<!-- wpv-loop-end -->' );
$out = substr( $out, 0, $end );
}
return $out;
}
/* Toolset: Taxonomies > Child Wrapper
================================================== */
function child_tax_mytaxo_shortcode( $atts, $content = null ) {
$args = array(
'title' => 'Taxonomy Child Wrapper',
'raw' => 'true',
);
$out = render_view($args);
return without_html($out);
}
add_shortcode( 'child_taxo_mytaxo', 'child_tax_mytaxo_shortcode' );
Note: the above views and shortcode are 'working' in the sense that they output the correct information. The problem is that they are still being wrapped by the Views div.
Thanks again in advance!