I'm trying to get meta information from the first four posts that have a meta key equal to Sedan, then format that posts meta in order to set up gallery type display boxes. I believe it has something to do with my method, as I am still on the steep part of the learning curve. Any comments, advice or answers would be deeply appreciated.
With this code, the HTML I'm trying to generate does not show on the front-end. As if I hadn't done anything.
add_shortcode('sedan-tabs','build_sedan_tabs');
function build_sedan_tabs(){
$args1 = array(
'meta_key' => 'vehicle-type',
'meta_value' => 'Sedan',
'posts_per_page' => '4'
);
$query1 = new WP_Query($args1);
while ( $query1->have_posts() ) {
$query1->the_post();
$currentPostID = get_the_id();
$querySedans = '<div class="col-sm-3><div class="display-car"><img src="' . get_post_meta(get_the_id(),'wpcf-vehicle-images', true) . '"/>' .
'<h3>' . get_post_meta($currentPostID,'wpcf-vehicle-year', true) . ' ' .
get_post_meta($currentPostID,'wpcf-vehicle-make', true) . ' ' .
get_post_meta($currentPostID,'wpcf-vehicle-model', true) .'</h3><p>' .
get_post_meta($currentPostID,'wpcf-vehicle-mileage', true) . ' ' .
get_post_meta($currentPostID,'wpcf-vehicle-transmission', true) . '<br /><strong>' .
get_post_meta($currentPostID,'wpcf-vehicle-retail-price', true) . '</strong></p></div></div><a href="' . get_permalink($currentPostID, false) . '"></a>';
return get_the_id();
}
}