Jorge Maldonado Ventura
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
Forum: Plugins
In reply to: [LibreVideoJS HTML5 Player] video on mobileIt should work for Android phones fine. The only problem are iPhones I think. This issue was submitted to the bug tracker of video.js (this video player is based on it), but was closed as it wasn’t a bug: https://github.com/videojs/video.js/issues/3784
Forum: Developing with WordPress
In reply to: How do I make the plugin only execute when it is used?I’m trying to use your solution, but I don’t know how to get the content. How can I do that?
get_the_content()
doesn’t work, I don’t know why. When Iecho get_the_content()
it doesn’t print anything. This is what I have so far…/** * Enqueue asciinema-player files. */ function enqueue_player() { wp_register_script('asciinema-player-js', plugins_url('asciinema-player.js', __FILE__), array(), $ver = '2.4.0', true); wp_register_style('asciinema-player-css', plugins_url('asciinema-player.css', __FILE__), array(), $ver = '2.4.0'); wp_enqueue_script('asciinema-player-js'); wp_enqueue_style('asciinema-player-css'); } /** * Whether the passed content contains the <asciinema-player> tag. * * @param string $content Content to search for the <asciinema-player> tag. * * @return bool Whether the passed content contains the <asciinema-player> tag. */ function has_asciinema_player_tag($content) { $asciinema_player_tag = '<asciinema-player>'; if (false === strpos($content, '<')) { echo $content; return false; } preg_match_all('/<asciinema-player>/', $content, $matches); if (empty($matches)) return false; else return true; } /** * Enqueue asciinema-player files if the asciinema-player tag is used. */ function execute() { if (has_asciinema_player_tag(get_the_content())) { add_action('wp_enqueue_scripts', 'enqueue_player'); } } execute();
Forum: Developing with WordPress
In reply to: How do I make the plugin only execute when it is used?Thanks for your suggestion Steve. But in this case, I want to embed the player using an HTML tag (
<asciinema-player src=”asciicast.json”></asciinema-player>
), which is the default way to use asciinema-player. Any way to do that?
Viewing 3 replies - 1 through 3 (of 3 total)