Created
June 30, 2021 08:10
-
-
Save propertyhive/867c71c008c65fe2b0aae7ae55bb2fd6 to your computer and use it in GitHub Desktop.
Ensure images in search results are consistent size by using background image instead of <img>
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
// Step 1: Add to functions.php | |
remove_action( 'propertyhive_before_search_results_loop_item_title', 'propertyhive_template_loop_property_thumbnail', 10 ); | |
// Step 2: Override the following templates (if not already present in yourtheme/propertyhive): | |
// content-property.php | |
// content-property-featured.php | |
// content-property-recent.php | |
// Step 3: Within each of the above templates change line 45 from: | |
<a href="<?php the_permalink(); ?>"> | |
// to... | |
<a href="<?php the_permalink(); ?>" style="padding-bottom:66.6%; background:url(<?php echo $property->get_main_photo_src('medium'); ?>) center center no-repeat; background-size:cover;"> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment