Skip Navigation

[Gelöst] wpv-conditional with shortcode

This support ticket is created vor 5 Jahre, 11 Monate. 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 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 Antwort, has 2 Stimmen.

Last updated by Shane vor 5 Jahre, 11 Monate.

Assisted by: Shane.

Author
Artikel
#872261

I Have created this shortcode:

//Shortcode para devolver el número de 'Contrataciones-1' hijas de 'universidad-popular'.
function jm_numero_contrataciones_user_universidad () {
$universidad_ID = get_the_ID(); // Coge el ID del cpt universidad-popular
//Código cogido de Post Relationships API de Toolset. Cuenta los cpt contrataciones-1 que pertenecen al cpt universidad
$query = new WP_Query(
array(
'post_type' => 'contrataciones-1',
'meta_query' => array(
array(
'key' => '_wpcf_belongs_universidad-popular_id',
'value' => $universidad_ID
)
),

)
);
$posts = $query->posts;
$counter = count($posts);
return $counter;
// -- FIN -- Código cogido de Post Relationships API de Toolset. Cuenta los cpt contrataciones-1 que pertenecen al cpt grupo
}
add_shortcode ('numero_contrataciones_user_universidad', 'jm_numero_contrataciones_user_universidad');

-------------------------------

I use this [numero_contrataciones_user_universidad] and return 2. That´s ok.

But when I use this in a wpv-conditional I can see:

Case 1:

Numero contrataciones universidad: [numero_contrataciones_user_universidad]
[wpv-conditional if="( '[numero_contrataciones_user_universidad]' >= '2' )"]TEST[/wpv-conditional]

Display:
Numero contrataciones universidad: 2
TEST

Case 2:

Numero contrataciones universidad: [numero_contrataciones_user_universidad]
[wpv-conditional if="( '[numero_contrataciones_user_universidad]' < '2' )"]TEST[/wpv-conditional]

Display:
Numero contrataciones universidad: 2
(nothing)

Is that right????

#872873

Shane
Supporter

Languages: Englisch (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

This is a duplicate ticket.

Can you please close this one.

Thanks,
Shane

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