Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.
Problem:
Child posts count
Solution:
User were using the the wrong funtion to fetch the child posts. You need to usee the Types post-relationship API function toolset_get_related_posts() and wrap with the shortcode.
This support ticket is created hace 5 años, 7 meses. 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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
Hello. Thank you for contacting the Toolset support.
Well - I need to review your jobs-count shortcode as well as can you please share problem URL where you added the conditional statement with jobs-count shortcode.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
I already mentioned the URL where the problem is enlace oculto
You can see 2 numbers before and after "Job(s)" (on top of logo on left) the 1st number is coming from view and 2nd number is coming from shortcode. You can see the code below I am using,
Also if you see in the link enlace oculto few companies is working from when there are no jobs but in few even if there are no jobs still getting some random number from shortcode but from view getting the count correctly.
I will not be able to provide access to the site as it is a production site and dont have a test setup for the same!
When you use custom shortode as Types shortcode's attribute argument, you need to register the custom shortcode at:
=> Toolset => Settings => Frontend content Tab => Third-party shortcode arguments
I had already registered the shortcode in settings.
Sorry but I didnt understand how would list with separators would help because If I select that option I will be able to add only one field and to show company list I will be needing multiple fields (currently using Content Templates for the view) And if I disable warping div the ajax filters wont work right? If I dont use ajax filters I am being redirected to Taxonomies archive page because the filters are based on custom taxonomies.
But when I try to login using shared wp-admin access details it asks me to add further authentication code:
An Authentication Code has been sent to the email address associated with your account. Look for an email with "Login Authentication Code" in the subject line.
Can you please remove this authentication for now so I can successfully log in to your site and check the issue.
Well - the function you ware using to fetch the child posts was wrong. You need to usee the Types post-relationship API function toolset_get_related_posts().
I've adjusted the shortcode as given under:
add_shortcode('jobs-count', 'jobs_count_func');
function jobs_count_func($atts) {
global $post;
$child_posts = toolset_get_related_posts($post->ID,'company-job','parent',999,0,array(),'post_id','child');
return count($child_posts);
}
I can see now its displaying correct results now:
=> enlace oculto