Making WordPress.org

Changeset 8748


Ignore:
Timestamp:
05/08/2019 04:30:59 PM (6 years ago)
Author:
vedjain
Message:

WC Campsite17: Content option support for featured image in custom CPT.

This patch adds featured image support to Custom Post Types as well like sponsors. This uses JetPack's content option feature so that displaying featured image is customizable.

For back compatibility in previous sites, this would disabled by default, and will enabled only for new WordCamp sites. Old WordCamp sites can enable this by going to Customizer->ContentOptions.

Fixes #3645 #4339
Props ryelle, vedjain

Location:
sites/trunk/wordcamp.org/public_html/wp-content/themes/campsite-2017
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/campsite-2017/inc/jetpack.php

    r5536 r8748  
    1616 *
    1717 * See: https://jetpack.com/support/infinite-scroll/
     18 * See: https://jetpack.com/support/content-options/
    1819 * See: https://jetpack.com/support/responsive-videos/
    1920 */
     
    2526            'render'    => __NAMESPACE__ . '\infinite_scroll_render',
    2627            'footer'    => 'page',
     28        )
     29    );
     30
     31    $featured_image_enabled = ! wcorg_skip_feature( 'cs17_display_featured_image' );
     32    add_theme_support(
     33        'jetpack-content-options',
     34        array(
     35            'featured-images'    => array(
     36                'archive'           => true,
     37                'archive-default'   => $featured_image_enabled,
     38                'post'              => true,
     39                'post-default'      => $featured_image_enabled,
     40                'page'              => true,
     41                'page-default'      => $featured_image_enabled,
     42                'fallback'          => false,
     43            ),
    2744        )
    2845    );
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/campsite-2017/template-parts/content-page.php

    r5536 r8748  
    1414<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1515    <header class="entry-header">
     16        <?php if ( has_post_thumbnail() ) : ?>
     17            <div class="entry-image">
     18                <?php the_post_thumbnail(); ?>
     19            </div>
     20        <?php endif; ?>
     21
    1622        <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
    1723    </header>
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/campsite-2017/template-parts/content-search.php

    r5536 r8748  
    1414<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    1515    <header class="entry-header">
     16        <?php if ( has_post_thumbnail() ) : ?>
     17            <div class="entry-image">
     18                <?php the_post_thumbnail(); ?>
     19            </div>
     20        <?php endif; ?>
     21
    1622        <?php the_title( sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
    1723
  • sites/trunk/wordcamp.org/public_html/wp-content/themes/campsite-2017/template-parts/content.php

    r5536 r8748  
    1515    <header class="entry-header">
    1616        <?php
     17
     18        if ( has_post_thumbnail() ) : ?>
     19            <div class="entry-image">
     20                <?php the_post_thumbnail(); ?>
     21            </div>
     22        <?php endif;
    1723
    1824        if ( is_single() ) {
Note: See TracChangeset for help on using the changeset viewer.