Plugin Directory

Changeset 984929


Ignore:
Timestamp:
09/09/2014 03:19:58 AM (12 years ago)
Author:
chriswallace
Message:

Added image to portfolio posts and featured image argument for theme support declaration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • freefolio/trunk/class.Freefolio.php

    r971794 r984929  
    5656    add_action( 'admin_enqueue_scripts',                                           array( $this, 'enqueue_admin_styles'  ) );
    5757    add_action( 'after_switch_theme',                                              array( $this, 'flush_rules_on_switch' ) );
     58    add_filter( 'the_content',                                                     array( $this, 'prepend_featured_image' ) );
    5859
    5960    // Portfolio shortcode
     
    397398
    398399  /**
     400   * Prepend the featured image for portfolio items when no featured image is supported.
     401   */
     402  function prepend_featured_image( $content ) {
     403    global $_wp_theme_features;
     404    if( ! current_theme_supports( 'jetpack-portfolio' ) || ( current_theme_supports( 'jetpack-portfolio' ) && ! $_wp_theme_features['jetpack-portfolio'][0]['has-featured-image'] ) ){
     405      $content = get_the_post_thumbnail( $post->ID, 'original' ) . $content;
     406    }
     407    return $content;
     408  }
     409
     410  /**
    399411   * Our [portfolio] shortcode.
    400412   * Prints Portfolio data styled to look good on *any* theme.
Note: See TracChangeset for help on using the changeset viewer.