After digging around StackOverflow and putting together pieces of code, I managed to formulate this below code. However, I can’t seem to figure out why it won’t display on the page.
At the present time I just have the word “test” just to see if the loop would fire.
What is the issue?
<?php add_shortcode( 'jobs-search-results', 'jobs_search_results' );
function jobs_search_results() {
ob_start();
$jobs_search_results_args = array (
'post_type' => array( 'job' ),
'meta_query' => array(
array(
'key' => 'client_state',
'value' => 'Alabama',
),
),
);
$jobs_search_results_query = new WP_Query( $jobs_search_results_args );
if ( $jobs_search_results_query->have_posts() ) : while($jobs_search_results_query->have_posts()) : $jobs_search_results_query->the_post();
?>
test
<?php endwhile;
$jobs_search_results_output = ob_get_clean();
return $jobs_search_results_output;
endif;
}
?>