Last active
August 12, 2016 14:13
-
-
Save propertyhive/fac44243f1c13e1690bbf4e15964daf2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$args = array( | |
'post_type' => 'property', | |
'post_status' => 'publish', | |
'nopaging' => true, | |
'orderby' => 'rand', | |
'meta_query' => array( | |
array( | |
'key' => '_on_market', | |
'value' => 'yes', | |
), | |
array( | |
'key' => '_featured', | |
'value' => 'yes' | |
) | |
) | |
); | |
$featured_property_ids = array(); | |
$properties = new WP_Query( $args ); | |
if ( $properties->have_posts() ) : | |
while ( $properties->have_posts() ) : | |
$properties->the_post(); | |
$featured_property_ids[] = $post->ID; | |
endwhile; // end of the loop. | |
endif; | |
wp_reset_postdata(); | |
// Not sure on the actual format of the [rev_slider] shortcode, but the key bit is the 'ids' bit. | |
// Note: apparently you need 0 as the first ID | |
// Ref: https://www.themepunch.com/faq/use-custom-wp-queries-post-based-sliders/ | |
echo do_shortcode( '[rev_slider alias="tester"]' . | |
'[gallery ids="0,' . implode( ",", $featured_property_ids ).'"]' . | |
'[/rev_slider]' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment