Add Javascript code in PHP file
<?php
//... lots of PHP code
add_shortcode('project','projects_shortcode');
function inc_js_shortcode() {
?>
<script type="text/javascript">
jQuery(document).ready(function(){
var mycontainer = jQuery('#projects');
mycontainer.isotope({
filter: '*',
animationOptions: {
duration: 750,
easing: 'liniar',
queue: false,
}
});
jQuery('#projects-filter a').click(function(){
var selector = jQuery(this).attr('data-filter');
mycontainer.isotope({
filter: selector,
animationOptions: {
duration: 750,
easing: 'liniar',
queue: false,
}
});
return false;
});
});
</script>
<?php
}
add_action('wp_footer','inc_js_shortcode');
// Lots of other PHP code below
// ...
?>