• Resolved master of web

    (@master-of-web)


    Hi
    is there a way to get a features image for the giveaway?

    If I go to the giveaway-overview (mysite.com/giveaway/) it loads a archive of all giveaways but without a thumbnail.

    Is it possible to automaticly output eg the facebook image as features image? I could also create a special archive-giveasap.php but I don’t know how to access the image since it’s not a standard featured image.

    Regards
    Jan

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Igor Benic

    (@ibenic)

    Hi @master-of-web, for now the actual WordPress (standard) featured-image is the Background Image since that was the initial plan for giveaways.

    This is a good point and I will see to change the background image to be something else and the featured image a different thing that can be used for archives.

    For now, you can use the facebook image if you want by using this code:

    
    // Inside of a single post loop:
    if ( function_exists( 'sg_get_giveaway' ) ) {
      $giveaway = sg_get_giveaway( get_post() );
      $display  = $giveaway->get_display_settings();
      $facebookImage = false;
      if( isset( $display['facebook_image'] ) && $display['facebook_image'] ) {
        $facebookImage = giveasap_get_image_url( $display['facebook_image'] ); 
      }
      
      if ( $facebookImage ) {
       echo '<img src="' . esc_url( $facebookImage ) . '" class="attachment-thumbnail size-thumbnail"/>';
      }
    }
    
    • This reply was modified 6 years, 1 month ago by Igor Benic.
    Thread Starter master of web

    (@master-of-web)

    Perfect, thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Featured image’ is closed to new replies.