Making WordPress.org


Ignore:
Timestamp:
02/19/2017 02:49:41 PM (7 years ago)
Author:
ocean90
Message:

Rosetta: Add thumbnail support to showcase CPT.

Allows to define a custom website screenshot if the auto-generated screenshot doesn't look pretty because of cookie notices or loading animations.

Fixes #2515.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/global.wordpress.org/public_html/wp-content/themes/rosetta/front-page.php

    r2249 r4937  
    8282    <li>
    8383        <a class="shot" href="<?php echo esc_url( $url ); ?>">
    84             <img src="<?php echo esc_url( $rosetta->screenshot_url( $url, 230 ) ); ?>" width="230" alt="screenshot" />
     84            <?php
     85            if ( has_post_thumbnail( $item->ID ) ) {
     86                echo get_the_post_thumbnail( $item->ID, 'showcase-thumbnail' );
     87            } else {
     88                ?>
     89                <img src="<?php echo esc_url( $rosetta->screenshot_url( $url, 220 ) ); ?>" width="220" alt="" />
     90                <?php
     91            }
     92            ?>
    8593        </a>
    8694        <?php echo esc_html( $item->post_title ); ?>
    8795        <br />
    88         <a href="<?php echo esc_url( $url ); ?>"><?php _e( 'Visit the site &rarr;', 'rosetta' ); ?></a>
     96        <a class="showcase-url" href="<?php echo esc_url( $url ); ?>" rel="nofollow"><?php _e( 'Visit the site &rarr;', 'rosetta' ); ?></a>
    8997    </li>
    9098<?php
Note: See TracChangeset for help on using the changeset viewer.