I have this typed.js code snippet, which I want to call from a shortcode:
<script src="https://www.example.com/wp-content/themes/mediso-v1-03/javascript/jquery-2.2.4.min.js"></script>
<script src="https://www.example.com/wp-content/themes/mediso-v1-03/javascript/typed.js"></script>
<script>// <![CDATA[
$(function(){ $(".element-typing").typed({ strings: ["This is my typing text"], typeSpeed: 20 }); });
// ]]></script>
<p class="element-typing"></p>
Here is what I came up with:
// Add Shortcode
function custom_shortcode23() {
wp_enqueue_script('script-typed-jquery', 'https://www.example.com/wp-content/themes/mediso-v1-03/jquery-2.2.4.min.js', array('jquery'));
wp_enqueue_script('script-typed', 'https://www.example.comwp-content/themes/mediso-v1-03/typed.js', array('jquery'));
echo '<script>// <![CDATA[$(function(){ $(".element-typing").typed({ strings: ["This is my typing text"], typeSpeed: 20 }); });',
'// ]]></script>',
'<p class="element-typing"></p>';
}
add_shortcode( 'typed23', 'custom_shortcode23' );
But it is not working. Where am I wrong?
echoanything.