Skip Navigation

[Resolved] show different content template or view based on URL choice and child post if ex

This support ticket is created 7 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by charlie 7 years, 11 months ago.

Assisted by: Luo Yang.

Author
Posts
#396142
templatestemma.jpg

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

#396234

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>
#396415

tnx

#396512

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]

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.