Hi there,
I’m a little confused as to what I need to do to have another jQuery script added to each post page.
I’m trying to add the TwentyTwenty plugin to the theme: http://zurb.com/playground/twentytwenty but not sure where I should be adding the lines to make things work.
In my child theme, I’ve added the following to my functions.php file:
function add_twentytwenty() {
?>
<script type="text/javascript">
$(window).load(function(){
$(".twentytwenty-container[data-orientation!='vertical']").twentytwenty({default_offset_pct: 0.7});
$(".twentytwenty-container[data-orientation='vertical']").twentytwenty({default_offset_pct: 0.3, orientation: 'vertical'});
});
</script>
<link href="twentytwenty.css" rel="stylesheet" type="text/css" />
<script src="custom-js/jquery.event.move.js"></script>
<script src="custom-js/jquery.twentytwenty.js"></script>
<?php
}
add_action('wp_footer', 'add_twentytwenty');
The script isn’t initializing and I’m not sure where to place this script if it’s not here. Can you let me know what I am doing wrong here?
Thank you!
Hi tkumabe!
Are you supposed to have some elements with a class of “.twentytwenty-container” in the page?
Best regards,
Elliott