P text added to html text

I know that there are many topics in this, and I already looked at them, and none of the solutions is applicable to me.

I put a short code to run jscript for the sensitive slider in the text part of my editor. However, when I load the page, the source code contains many paragraph tags after each javascript line. He even has a paragraph tag before he even asks for the content itself.

I tried editing the functions.php file of my theme (Reason 2.0), but I'm not sure I can tag it correctly, it is very php-heavy. I also tried the five plugins offered here. None of them have any effect.

The code is terrible and looks like this:

<p> <!-- START REVOLUTION SLIDER --></p> <div id="rev_slider_1_1_wrapper" class="rev_slider_wrapper" style="margin:0px auto;background-color:#E9E9E9;padding:0px;margin-top:0px;margin-bottom:0px;"> <div id="rev_slider_1_1" class="rev_slider" style="display:none;"> <ul> <li data-transition="slidehorizontal" data-slotamount="5" data-masterspeed="300" data-link="http://www.secondhandculture.org/mad-men-and-attraction" > <img src="http://www.secondhandculture.org/wp-admin/admin-ajax.php?action=revslider_show_image&#038;img=uploads%2F2012%2F12%2Fmad-men-image.jpg&#038;h=300&#038;t=exact" ></p> <div class="caption sft"<br /> data-x=&#8221;400&#8243;<br /> data-y=&#8221;20&#8243;<br /> data-speed=&#8221;300&#8243;<br /> data-start=&#8221;200&#8243;<br /> data-easing=&#8221;easeOutExpo&#8221;><img src="http://www.secondhandculture.org/wp-content/uploads/2012/12/Mad-men-text.png" alt="Mad Men"></div> <div class="caption big_white sfr"<br /> data-x=&#8221;550&#8243;<br /> data-y=&#8221;140&#8243;<br /> data-speed=&#8221;300&#8243;<br /> data-start=&#8221;500&#8243;<br /> data-easing=&#8221;easeOutExpo&#8221;>How it makes us love <br><br /> what we know we should hate, <br><br /> and asks us why</div> </li> </ul> <div class="tp-bannertimer tp-bottom"></div> </p> </div> </div> <p> <script type="text/javascript"></p> <p> var tpj=jQuery;</p> <p> tpj.noConflict();</p> <p> tpj(document).ready(function() {</p> <p> if (tpj.fn.cssOriginal != undefined) tpj.fn.css = tpj.fn.cssOriginal;</p> <p> var revapi1 = tpj('#rev_slider_1_1').show().revolution( { delay:9000, startwidth:, startheight:300, hideThumbs:200,</p> <p> thumbWidth:100, thumbHeight:50, thumbAmount:1,</p> <p> navigationType:"none", navigationArrows:"nexttobullets", navigationStyle:"round",</p> <p> touchenabled:"on", onHoverStop:"on",</p> <p> navOffsetHorizontal:0, navOffsetVertical:20,</p> <p> shadow:2, fullWidth:"off",</p> <p> stopLoop:"off", stopAfterLoops:-1, stopAtSlide:-1,</p> <p> shuffle:"off" });</p> <p> }); //ready</p> <p> </script></p> <p> <!-- END REVOLUTION SLIDER --></p> 
+4
source share
3 answers

I had the same problem and add_filter( 'the_content', 'wpautop') does not work on my theme. So, I did the following:

  • In the admin revo slider area, select a slider that does not display well.

  • Find the troubleshooting tab (bottom right), then change the values

  • JQuery No Conflict Mode = ON

  • Put JS Includes in Body = FALSE

  • ( Important ) Protection of output filters = Compression of output

This way, the script will only be on one line, so the automatic paragraph filter will just add the p tag to one line

+4
source

A common reason for this is that the author of the topic changed the priority of the output filters in the topic or even replaced the default ones of their own. That way, when you insert a short Revolution slider slide, paragraph tags are inserted into each line of output, breaking the Javascript code. A typical message in the Firefox error console:

 Error: SyntaxError: syntax error Source Code: </p> 

This is a topic that the topic author should fix. If you want to try to fix this yourself, find a line, for example:

 add_filter( 'the_content', 'wpautop' , 99); 

and change the priority (99) of the filter to something like 9. This can help, but also break something else. In some topics, the code is not quite right, but you can look for a function to add or remove filters from the output of short codes. You can see examples on the pages that I provided below.

Nevertheless , before doing this, try this: in the latest versions of the Revolution slider there is an opportunity to avoid filtering . When you create a slider, in the "Troubleshooting" field there is an option "Protect output filters". Turn it on (I used the "By Echo Output" parameter).

This is a known issue with some Wordpress themes. Also note that if the theme has affected this plugin, it will surely affect other plugins.

A few comments about this issue are posted at http://pippinsplugins.com/never-remove-the-default-the_content-filters-in-themes/ and http://theandystratton.com/2011/shortcode-autoformatting-html-with- paragraphs-and-line-breaks

From the first link (Never remove the_content's default filters in Themes):

There is a terrible, scary practice among developers to remove some default filters that apply to the message and page content ...

From the second link (Shortcode Autoformatting HTML with paragraphs and line breaks):

... this mysterious problem of my short code output is mysteriously automated with paragraph tags and line breaks ... Its global removal of two very important filters of the main content that WP has built-in ... This makes this theme work perfectly and negatively affect ANY and ALL plugins with short codes ...

The final decision is the comment mentioned in the second article:

Do not use a topic in which bad code.

+2
source

Do not use inline JS - use register_script () and wp_enqueue_script

 function o99_load_my_scripts() { // Register for a plugin: wp_register_script( 'custom-script', plugins_url( '/js/my-custom-script.js', __FILE__ ) ); // or // Register for a theme: wp_register_script( 'custom-script', get_template_directory_uri() . '/js/my-custom-script.js' ); // then, you can then enqueue the script: wp_enqueue_script( 'custom-script' ); } add_action( 'wp_enqueue_scripts', 'o99_load_my_scripts' ); 
0
source

All Articles