'abddir_listing', 'post_status' => 'publish', 'posts_per_page' => $per_page, 'paged' => $paged, 'orderby' => 'title', 'order' => 'ASC', 'meta_query' => [[ 'key' => 'abddir_directory_id', 'value' => $dir_id, 'compare' => $dir_id ? '=' : 'EXISTS', ]], ]; if ( $search ) { $args['s'] = $search; } $query = new WP_Query($args); $html = ''; if ( $query->have_posts() ) { ob_start(); $template = $layout === 'list' ? abddir_PLUGIN_DIR . 'templates/list.php' : abddir_PLUGIN_DIR . 'templates/grid.php'; include $template; $html = ob_get_clean(); } else { $html = '
No listings found matching your search.