I use a slider called revoslider and use it via shortcode.
When i use the shortcode and do not use visual editor for insert and save, the slider does not work because WordPress adds <p>
into javascript like this :
<p> <script type="text/javascript"></p>
<p> var tpj=jQuery;</p>
<p> tpj.noConflict();</p>
<p> var revapi1;</p>
<p> tpj(document).ready(function() {</p>
<p> if (tpj.fn.cssOriginal != undefined)
tpj.fn.css = tpj.fn.cssOriginal;</p>
<p> if(tpj('#rev_slider_1_1').revolution == undefined)
revslider_showDoubleJqueryError('#rev_slider_1_1');
else
revapi1 = tpj('#rev_slider_1_1').show().revolution(
{
delay:9000,
startwidth:960,
startheight:350,
hideThumbs:200,</p>
<p> thumbWidth:100,
thumbHeight:50,
thumbAmount:2,</p>
<p> navigationType:"bullet",
navigationArrows:"solo",
navigationStyle:"round",</p>
<p> touchenabled:"on",
onHoverStop:"on",</p>
<p> navigationHAlign:"center",
navigationVAlign:"bottom",
navigationHOffset:0,
navigationVOffset:20,</p>
<p> soloArrowLeftHalign:"left",
soloArrowLeftValign:"center",
soloArrowLeftHOffset:20,
soloArrowLeftVOffset:0,</p>
<p> soloArrowRightHalign:"right",
soloArrowRightValign:"center",
soloArrowRightHOffset:20,
soloArrowRightVOffset:0,</p>
<p> shadow:2,
fullWidth:"off",</p>
<p> stopLoop:"off",
stopAfterLoops:-1,
stopAtSlide:-1,</p>
<p> shuffle:"off",</p>
<p> hideSliderAtLimit:0,
hideCaptionAtLimit:0,
hideAllCaptionAtLilmit:0,
startWithSlide:0
});</p>
<p> }); //ready</p>
<p> </script></p>
Because of this, the code does not work and I don´t understand why WordPress adds these <p>
for each line – it´s ridicoulus.
I tried add_filter
for content but it also does not work.
You have to either
1) take all the whitespace out of the script so WordPress does not add
<p>
tags and then the JS will work, or2) disable
autop
in the post editor for all posts/pages(see http://codex.wordpress.org/Function_Reference/wpautop ) so WP doesn’t add paragraph breaks, or
3) do the following, which leaves
autop
enabled globally, but lets you disable it with and tags in individual posts and pages.Add the function below to functions.php and use the two tags
<!-- noformat on -->
and<!-- noformat off -->
in your page/post editor, i.e.
Content outside of the two format tags will have autop enabled, as noted.
Add to functions.php of the theme: