Making WordPress.org

Changeset 3602


Ignore:
Timestamp:
06/28/2016 09:57:35 PM (10 years ago)
Author:
iandunn
Message:

WordCamp Post Types: Add custom image size for sponsor logos.

This prevents them from being cropped in undesirable ways.

Location:
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/css/shortcodes.css

    r1573 r3602  
    108108        content: '';
    109109}
     110
     111/*
     112 * [sponsors]
     113 */
     114.wcorg-sponsors img {
     115        width: auto;
     116        height: auto;
     117        max-width: 100%;
     118        max-height: 150px;
     119}
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/inc/widgets.php

    r3280 r3602  
    3838                        .wcb_widget_sponsors .sponsor-logo {
    3939                                display: block;
     40                                padding-bottom: 10px;
    4041                        }
     42
    4143                        .wcb_widget_sponsors .sponsor-logo img {
    4244                                max-width: 100%;
    … …  
    4446
    4547                                /* Conform to https://adblockplus.org/acceptable-ads */
    46                                 max-height: 300px;
     48                                max-height: 150px;
    4749                                width: auto;
    4850                        }
    … …  
    6971
    7072                                        <a class="sponsor-logo" href="<?php the_permalink(); ?>">
    71                                                 <?php ( has_post_thumbnail() ) ? the_post_thumbnail() : the_title(); ?>
     73                                                <?php ( has_post_thumbnail() ) ? the_post_thumbnail( 'wcb-sponsor-logo-horizontal-2x' ) : the_title(); ?>
    7274                                        </a>
    7375
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wc-post-types/wc-post-types.php

    r3361 r3602  
    1919                add_action( 'init', array( $this, 'register_taxonomies' ) );
    2020                add_action( 'init', array( $this, 'init' ) );
     21                add_action( 'after_theme_setup', array( $this, 'add_image_sizes' ) );
    2122
    2223                add_action( 'admin_init', array( $this, 'admin_init' ) );
    … …  
    8081
    8182                add_action( "admin_print_scripts-$page", array( $this, 'enqueue_order_sponsor_levels_scripts' ) );
     83        }
     84
     85        /**
     86         * Add custom image sizes
     87         */
     88        function add_image_sizes() {
     89                add_image_size( 'wcb-sponsor-logo-horizontal-2x', 600, 220, false );
    8290        }
    8391
    … …  
    10981106                                        <div class="wcorg-sponsor-description">
    10991107                                                <?php if ( 'website' == $attr['link'] && $website ) : ?>
    1100                                                         <a href="<?php echo esc_attr( esc_url( $website ) ); ?>"><?php the_post_thumbnail(); ?></a>
     1108                                                        <a href="<?php echo esc_attr( esc_url( $website ) ); ?>">
     1109                                                                <?php the_post_thumbnail( 'wcb-sponsor-logo-horizontal-2x' ); ?>
     1110                                                        </a>
    11011111                                                <?php else : ?>
    1102                                                         <?php the_post_thumbnail(); ?>
     1112                                                        <?php the_post_thumbnail( 'wcb-sponsor-logo-horizontal-2x' ); ?>
    11031113                                                <?php endif; ?>
    11041114
Note: See TracChangeset for help on using the changeset viewer.