wecobble / Subtitles

Add subtitles into your WordPress posts, pages, custom post types, and themes. No coding required. Simply activate Subtitles and you're ready to go.
http://wordpress.org/plugins/subtitles/
GNU General Public License v2.0
117 stars 186 forks source link

Maybe don't load CSS when 'subtitle_view_supported' filter is set to false #102

Closed websevendev closed 6 years ago

websevendev commented 6 years ago

Hello,

I'm adding support for this plugin into my theme and am taking the subtitle directly from post meta and adding it with custom markup.

I'm using add_filter('subtitle_view_supported', '__return_false'); to disable the default functionality, how ever it also outputs the CSS in the head which is not needed in my use case:

<style type="text/css" media="screen">
    /**
     * Plugin Name: Subtitles
     * Plugin URI: http://wordpress.org/plugins/subtitles/
     * Description: Easily add subtitles into your WordPress posts, pages, custom post types, and themes.
     * Author: We Cobble
     * Author URI: https://wecobble.com/
     * Version: 2.2.0
     * License: GNU General Public License v2 or later
     * License URI: http://www.gnu.org/licenses/gpl-2.0.html
     */

    /**
     * Be explicit about this styling only applying to spans,
     * since that's the default markup that's returned by
     * Subtitles. If a developer overrides the default subtitles
     * markup with another element or class, we don't want to stomp
     * on that.
     *
     * @since 1.0.0
     */
    span.entry-subtitle {
        display: block; /* Put subtitles on their own line by default. */
        font-size: 0.53333333333333em; /* Sensible scaling. It's assumed that post titles will be wrapped in heading tags. */
    }
    /**
     * If subtitles are shown in comment areas, we'll hide them by default.
     *
     * @since 1.0.5
     */
    #comments .comments-title span.entry-subtitle {
        display: none;
    }
</style>

Would be great if the subtitle_view_supported filter would also turn that off or a separate filter for removing it, as it's not using the wp_enqueue_style to be easily removable.

Thanks.

websevendev commented 6 years ago

Aaand I just read the readme, ignore this.

if ( class_exists( 'Subtitles' ) && method_exists( 'Subtitles', 'subtitle_styling' ) ) {
    remove_action( 'wp_head', array( Subtitles::getInstance(), 'subtitle_styling' ) );
}