Can’t find variable is_single in my jQuery plugin
The easiest way in WP to write php into JS is using wp_footer function sse246626_js() { if(is_single()) { echo ‘<script type=”text/javascript”>’; echo ‘jQuery(document).ready(function($) {‘; echo ‘$(“#mydiv”).hide();’; echo ‘});’; echo ‘</script>’; } } add_action(‘wp_footer’, ‘sse246626_js’); This way gives you access to the WP functions as you need, there are probably better ways of doing it if … Read more