Support Forum

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Output Custom Field in Div Class Reply To: Output Custom Field in Div Class

#5525
Janek
Participant

Holy shit, it works! Your a legend! Thanks for the help! I think I’m slowly grasping the basics of PHP… but don’t think youve seen the last of me! 🙁

I used the following for anyone who might come after me:

add_action( 'wpsp_after_title', 'tu_add_advertising_images' );
function tu_add_advertising_images() {
if ( function_exists( 'get_field' ) ) {
        $image = get_field('advertisement_desktop');
  $mobile_image = get_field('advertisement_mobile');

        if ( ! empty( $image ) ): ?>
		  
<div class="desktop-image">		  
		  <img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />   
</div>

<div class="mobile-image">
    <img src="<?php echo $mobile_image['url']; ?>" alt="<?php echo $mobile_image['alt']; ?>" />
</div>
  <?php endif;
  
    }
}