Shortcode jumps out to first place inside div
-
Lets take simple example:
function foobar_func( $atts ){ return "foo and bar"; } add_shortcode( 'foobar', 'foobar_func' );
This will work nice.
But this, when you need to call an javascript inside shortcode:
function foobar_func( $atts ){ ?> <?php echo $content; ?> <script type="text/javascript"> ...... </script> <?php } add_shortcode( 'foobar', 'foobar_func' );
The second one will jump to first place inside div.
And it is needed to call jquery or javascript inside.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Shortcode jumps out to first place inside div’ is closed to new replies.