Skip to content
This repository has been archived by the owner on Dec 17, 2021. It is now read-only.

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

Closed
websevendev opened this issue Mar 21, 2018 · 1 comment

Comments

@websevendev
Copy link

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
Copy link
Author

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' ) );
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant