Skip to content

Instantly share code, notes, and snippets.

@patrickfreitasdev
Last active November 6, 2022 13:41
Show Gist options
  • Save patrickfreitasdev/155c44a0715ed3a0c70bc7d0de71bae3 to your computer and use it in GitHub Desktop.
Save patrickfreitasdev/155c44a0715ed3a0c70bc7d0de71bae3 to your computer and use it in GitHub Desktop.
<?php
/**
* Print muse video ai using shortcode [muse-video-embed]
* use id to define the video and width for size, e.g: [muse-video-embed id="c41FczZ" width="800"]
*/
//Using this to protect the plugin
defined( 'ABSPATH' ) or die( 'What are you looking for?' );
function muse_ai_custom_plugin( $atts = '' ){
ob_start();
$v_id = ( isset( $atts['id'] ) ) ? $atts['id'] : 'c41FczZ';
$v_width = ( isset( $atts['width'] ) ) ? $atts['width'] : '800';
$v_data_links = ( isset( $atts['data-links'] ) ) ? $atts['data-links'] : '0';
$v_data_search = ( isset( $atts['data-search'] ) ) ? $atts['data-search'] : '0';
$v_data_logo = ( isset( $atts['data-logo'] ) ) ? $atts['data-logo'] : '0';
?>
<div class="muse-video-player" data-video="<?= $v_id ?>" data-width="<?= $v_width ?>" data-links="<?= $v_data_links ?>" data-search="<?= $v_data_search ?>" data-logo="<?= $v_data_logo ?>"></div>
<?php
return ob_get_clean();
}
add_shortcode('muse-video-embed','muse_ai_custom_plugin');
function enqueue_muse_script() {
wp_enqueue_script( 'muse-script', 'https://muse.ai/static/js/embed-player.min.js',false, false, true );
}
add_action( 'wp_enqueue_scripts', 'enqueue_muse_script' );
@rupokify
Copy link

rupokify commented Dec 2, 2020

<?php

/**
 * Print muse video ai using shortcode [muse-video-embed]
 * use id to define the video and width for size, e.g: [muse-video-embed id="c41FczZ" width="800"]
 */

//Using this to protect the plugin
defined('ABSPATH') or die('What are you looking for?');


function muse_ai_custom_plugin($atts = ''){

    ob_start();

    $v_id = (isset($atts['id'])) ? $atts['id'] : 'c41FczZ';
    $v_width = (isset($atts['width'])) ? $atts['width'] : '800';

    ?>

    <div class="muse-video-player" data-video="<?= $v_id ?>" data-width="<?= $v_width ?>"></div>

    <?php

    return ob_get_clean();

}add_shortcode('muse-video-embed','muse_ai_custom_plugin');

function enqueue_muse_script() {
    wp_enqueue_script( 'muse-script', 'https://muse.ai/static/js/embed-player.min.js',false, false, true );
}
add_action( 'wp_enqueue_scripts', 'enqueue_muse_script' );

@rupokify
Copy link

rupokify commented Dec 3, 2020

"data-links", "data-search", "data-logo" attributes added.

<?php

/**
 * Print muse video ai using shortcode [muse-video-embed]
 * use id to define the video and width for size, e.g: [muse-video-embed id="c41FczZ" width="800"]
 */

//Using this to protect the plugin
defined( 'ABSPATH' ) or die( 'What are you looking for?' );


function muse_ai_custom_plugin( $atts = '' ){

    ob_start();

    $v_id = ( isset( $atts['id'] ) ) ? $atts['id'] : 'c41FczZ';
    $v_width = ( isset( $atts['width'] ) ) ? $atts['width'] : '800';
    $v_data_links = ( isset( $atts['data-links'] ) ) ? $atts['data-links'] : '0';
    $v_data_search = ( isset( $atts['data-search'] ) ) ? $atts['data-search'] : '0';
    $v_data_logo = ( isset( $atts['data-logo'] ) ) ? $atts['data-logo'] : '0';

    ?>

    <div class="muse-video-player" data-video="<?= $v_id ?>" data-width="<?= $v_width ?>" data-links="<?= $v_data_links ?>"  data-search="<?= $v_data_search ?>" data-logo="<?= $v_data_logo ?>"></div>

    <?php

    return ob_get_clean();

}
add_shortcode('muse-video-embed','muse_ai_custom_plugin');

function enqueue_muse_script() {

    wp_enqueue_script( 'muse-script', 'https://muse.ai/static/js/embed-player.min.js',false, false, true );

}
add_action( 'wp_enqueue_scripts', 'enqueue_muse_script' );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment