Making WordPress.org

Changeset 1334


Ignore:
Timestamp:
02/26/2015 12:33:20 AM (10 years ago)
Author:
obenland
Message:

WP.org Themes: Check if there is an image before taking a screenshot.

See https://wordpress.slack.com/archives/meta/p1424910214002224, #745.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-themes/page-commercial.php

    r1331 r1334  
    4141                                while ( $theme_shops->have_posts() ) :
    4242                                    $theme_shops->the_post();
     43
     44                                    if ( ! $image_url = post_custom( 'image_url' ) ) :
     45                                        $image_url = sprintf( '//s0.wp.com/mshots/v1/%s?w=572', urlencode( post_custom( 'url' ) ) );
     46                                    endif;
    4347                            ?>
    4448                            <article id="post-<?php the_ID(); ?>" <?php post_class( array( 'theme', 'hentry' ) ); ?>>
    4549                                <div class="theme-screenshot">
    46                                     <img src="<?php echo esc_url( '//s0.wp.com/mshots/v1/' . urlencode( post_custom( 'url' ) ) . '?w=572' ); ?>" alt="">
     50                                    <img src="<?php echo esc_url( $image_url ); ?>" alt="">
    4751                                </div>
    4852                                <a class="more-details url" href="<?php echo esc_url( post_custom( 'url' ) ); ?>" rel="bookmark"><?php the_content(); ?></a>
Note: See TracChangeset for help on using the changeset viewer.