I am trying to: I have got a parent table Comuni and a child table Stemmi (stemma). First I want to check if child post exist with this function put in function page of the theme
add_shortcode( 'child-stemma', 'child_stemma_func' );
function child_stemma_func( $atts ) {
$child_posts = types_child_posts('stemma');
if ($child_posts) return true;
}
}
I registered the shortcode child-stemma.
Then I want to create a menu from which i choose which section to load into the layout
<ul class="nav nav-tabs">
[wpv-conditional if="( '[child-stemma]' eq 'true' )"]
<li><a href="[wpv-post-url]?section=stemma">
Stemma</a></li>[/wpv-conditional]
</ul>
After this i choose in the layout which section to show <code [wpv-conditional if="( 'section' eq '' )"]comune info[/wpv-conditional][wpv-conditional if="( 'section' eq 'stemma' )"]widget stemma[/wpv-conditional] [/php]
I visited this URL:
hidden link
I expected to see:
Instead, I got:nothing appears
Dear charlie,
There is an error in your PHP codes, please modify it as below:
add_shortcode( 'child-stemma', 'child_stemma_func' );
function child_stemma_func( $atts ) {
$child_posts = types_child_posts('test-3');
$res = 0;
if ($child_posts) $res = 1;
return $res;
}
use it like this:
<ul class="nav nav-tabs">
[wpv-conditional if="'[child-stemma]' eq 1 "]
<li><a href="[wpv-post-url]?section=stemma">
Stemma</a></li>
[/wpv-conditional]
</ul>
Sorry, another question:
when in the url there's nothing (like ?section=stemma) how can I show the template info?
[wpv-conditional if="[wpv-post-url]' eq '' "]
show template info comune
[/wpv-conditional]