Reputation: 3370
i'm using this code for import an external html file in my plugin:
<?php
...
function showCalendar() {
include 'index.html';
}
add_shortcode( 'calendar', 'showCalendar' );
?>
but into the html i have some of javascript code like this:
<head>
<script type="text/javascript" src="js/jquery-1.11.1.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.11.1.js"></script>
<script type="text/javascript" src="jquery-ui.mycode.js"></script>
</head>
<body>
<div class="box">
<script>
/*some code*/
</script>
</div>
</body>
Wordpress is not executing that part. How can i fix that? thx!
Upvotes: 0
Views: 441
Reputation: 2573
In Wordpress you can't include scripts directly in files.
You should include your script using wp_enqueue_scripts, or you can register the scripts and include later when you need it using wp_register_scripts.
Upvotes: 0