Making WordPress.org

Changeset 2795


Ignore:
Timestamp:
03/24/2016 10:20:26 PM (8 years ago)
Author:
iandunn
Message:

WordCamp Post Type: Only print styles if the shortcode is present.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/branches/application-tracking/wordcamp.org/public_html/wp-content/plugins/wcpt/applications/tracker.php

    r2786 r2795  
    44defined( 'WPINC' ) or die();
    55
    6 add_shortcode( 'application-tracker', __NAMESPACE__ . '\render_status_shortcode' );
    7 add_action( 'wp_print_styles',        __NAMESPACE__ . '\print_shortcode_styles'  );
     6const SHORTCODE_SLUG = 'application-tracker';
     7
     8add_shortcode( SHORTCODE_SLUG, __NAMESPACE__ . '\render_status_shortcode' );
     9add_action( 'wp_print_styles', __NAMESPACE__ . '\print_shortcode_styles'  );
    810
    911/**
     
    4648 */
    4749function print_shortcode_styles() {
    48     // todo if doesn't have shortcode, return
     50    global $post;
     51
     52    if ( empty( $post->post_content ) || ! has_shortcode( $post->post_content, SHORTCODE_SLUG ) ) {
     53        return;
     54    }
    4955   
    5056    ?>
Note: See TracChangeset for help on using the changeset viewer.