Reputation: 65
I use a slider called revoslider and use as other sliders shortcodes for show this elements
When I use the shortcode without using the visual editor to insert and save, the slider doesn't works because WordPress adds <p>
tags into the javascript:
<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 never works and I don't understand why WordPress adds these <p>
for each line, it's ridiculous
I tried add_filter
for content it still doesn't work.
Upvotes: 2
Views: 1326
Reputation: 261
For those who might have had a similar issue, what worked for me was the following:
Since I concluded the issue was within my theme, I had spent some time looking for the issue and found the one line causing the issue:
add_filter( 'the_content', 'do_shortcode', 7 );
I just commented it out and it sorted out the problem.
Upvotes: 1
Reputation: 47
Have you tried surrounding your code with <div></div>
(without using any class or id)? It prevents Wordpress from surrounding text with <p></p>
tags. I've used it to prevent <p></p>
tags appearing around images, as described in this topic over at Wordpress.org.
Upvotes: 1
Reputation: 25001
When editing a slider, in the Troubleshooting section, you've got an option called Output Filters Protection. Set it to By Echo Output, and revslider's shortcode function will bypass filters, including the faulty one that adds this <p>
tags... It does that by outputting (echo) its content directly instead of returning it to wordpress.
Upvotes: 1
Reputation: 2273
I had the same problem once, and add_filter( 'the_content', 'wpautop')
does not work on my theme. So what I did was the following:
In the revo slider admin area, select the slider that is not displaying well.
Look for the troubleshooting tab (Bottom right) then change the values
Jquery No Conflict Mode = ON
Put JS Includes To Body = FALSE
(Important part) Output Filters Protection = By Compressing Output
That way, the script will be just in one line therefore the auto paragraph filter will just add the p tag to a single line
Upvotes: 1
Reputation: 753
Have you seen this topic on wp?
http://wordpress.org/support/topic/shortcode-is-being-surrounded-by-p-tags
seems to be a problem with nested shortcodes .. If it is your Issue at all? Do you have a link to the slider you are using?
Upvotes: 1