Add this to the functions.php
function function_name() { ?> whatever you want to print <?php } add_action( 'wp_footer', 'function_name' ); function function_name() { ?> whatever you want to print <?php } add_action( 'wp_head', 'function_name' );
Add this to the functions.php
function function_name() { ?> whatever you want to print <?php } add_action( 'wp_footer', 'function_name' ); function function_name() { ?> whatever you want to print <?php } add_action( 'wp_head', 'function_name' );
0 people found this article useful
0 people found this article useful
If you want to selectively run code by page ID do this:
2
3
4
5
6
7
8
9
10
11
12
13
if(get_the_ID()== 1111){
?>
<script type='text/javascript'>
jQuery(window).load(function () {
/*run any js code you want..etc.*/
setTimeout(function(){jQuery('[name=somename]').val('somevalue')},500);
});
</script>
<?php
}
}
add_action( 'wp_footer', 'some_func' );
Important note: The get_the_ID() must be inside the function for it to work. It doesn’t work outside because ID not loaded yet in WP at that point.