Problem:
The issue here is that the user wanted to check if their post parent is empty.
Solution:
This can be done with a little custom code.
Sure i'll just modify the code a little so that it can work for your case.
Add the shortcode below to your site.
// Add Shortcode function wp_post_has_content( $atts ) { // Attributes $atts = shortcode_atts( array( 'relationship' => '', ), $atts ); $return = 0; $postid = do_shortcode("[wpv-post-id item='".$atts['relationship']."']"); $object = get_post($postid); if ( empty( $object->post_content ) ) { // return 0 when post's content is empty $return = 0; } else { // return 1 when post's content is not empty $return = 1; } return $return; } add_shortcode( 'has_content', 'wp_post_has_content' );
Add this shortcode to the Toolset custom code section in Toolset -> Settings -> Custom Code. Then from there you need to add the shortcode name "has_content" to 3rd party shortcode arguments in Toolset->Settings->Frontend.
The usage of the code is
[has_content relationship= "@nemovitost-spolecnosti.parent"]
From there you should be able to get the content information.
You can use this shortcode in a conditional as well.
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.
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 6 replies, has 2 voices.
Last updated by 5 years, 2 months ago.
Assisted by: Shane.