[Closed] Filter for properties where not parent has been assigned
This support ticket is created 8 years, 3 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.
I would like to filter for Properties, that are children of Agents, where no agent has been assigned to the property. I don't know if the system records those records as Agent Title being empty or perhaps the word None.
What would be the correct way to express that kind of filter?
There is nothing ready for that, I have to talk to our development team in order to find a workaround for you. I'll let you as soon as I find something.
It looks to me like the code should work.
However, the view returns ALL the properties.
Am I supposed to add a filter on the view or should the function be enough?
Function reads
<?php
//functions for Divi for berrylandco.com JEL 09/10/14
add_shortcode('images', 'images_shortcode');
function images_shortcode() {
global $post;
$out = '';
$attachments = get_posts( array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image') );
foreach ($attachments as $attachment) {
$out .= wp_get_attachment_image($attachment->ID, 'thumbnail');
}
return $out;
}
function my_scripts() {
wp_enqueue_style( 'style-flexslider', get_stylesheet_directory_uri(). '/css/flexslider.css' );
wp_enqueue_script( 'script-flexslider', get_stylesheet_directory_uri() . '/js/jquery.flexslider.js', array(), '1.0.0', true );
}
Please replace agent with the slug of Agents post type
More help:
(Note: Due to bug #23268, value is required for NOT EXISTS comparisons to work correctly prior to 3.9. You must supply some string for the value parameter. An empty string or NULL will NOT work. However, any other string will do the trick and will NOT show up in your SQL when using NOT EXISTS. http://codex.wordpress.org/Class_Reference/WP_Query#Custom_Field_Parameters
The topic ‘[Closed] Filter for properties where not parent has been assigned’ is closed to new replies.