I have the following code in my functions.php file:-
function featured_properties_func( $atts ) { $args = array( 'posts_per_page'=> -1, 'post_type' => 'properties', ); $featured_query = new WP_Query( $args ); if( $featured_query->have_posts() ): while( $featured_query->have_posts() ) : $featured_query->the_post(); $featured_properties = get_the_title(); return $featured_properties; endwhile; endif; wp_reset_query(); } add_shortcode( 'featured_properties', 'featured_properties_func' );
When I output the shortcode I'm only getting one value where as it should be returning 6.
What I want to do is loop all the properties and return the title of each, any ideas what I am doing wrong?