default featured image on IDX pages
-
The theme I am using generates a header image in the header.php file which is called in all page templates. The code in the header.php file looks like this:
<div class="header-area" data-parallax="scroll" data-image-src="<?php echo wp_get_attachment_url( get_post_thumbnail_id($post->ID)); ?>">
Because the IDX pages are generated dynamically, I am unable to set a featured image and the result is a large white space above the fold where the image should be.
ex.) https://www.pagosalandcompany.com.php56-3.ord1-1.websitetestlink.com/homes-for-sale-details/EPR-LOT9-RAPTOR-PLACE-PAGOSA-SPRINGS-CO-81147/710887/392/I have been trying different ways to set a default featured image. I installed the Default Featured Image plugin with no luck. I am new to php, and have tried replacing the above php code in the header.php file with:
<?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { ?> <img src="<?php bloginfo('cafe-soux'); ?>/img/default-image.jpg" alt="Pagosa Land Company" /> <?php } ?>
I have the default image in the ‘img’ folder within the cafe-soux theme folder. This fix does not display any header images what so ever.
Is there a mistake in my php code or any other solution I can pursue to solve this issue?
Thank you
- The topic ‘default featured image on IDX pages’ is closed to new replies.