TARKUS TARKUS - 2 months ago 12
HTML Question

WordPress adds p tags to plugin code output

If I make a page, and in the editor enter one thing, a Slider Revolution shortcode (

[rev_slider alias="grill_accessories"][/rev_slider]
), my slideshow doesn't work. The height is only 48 pixels high for some reason. You can see an example page here: sample slider page

As I inspect the html using Web Developer in Chrome (or FireFox), I notice there are p tags interspersed in and around the
<script>
code output from the output.class.php file.

For example, here is a code sample function from the output.class.php file which creates a
<script>
output:

public function add_inline_styles(){

if(!is_admin()){
echo '<script>var htmlDiv = document.getElementById("rs-plugin-settings-inline-css"); var htmlDivCss="';
}
else echo "<style>";

$db = new RevSliderDB();

$styles = $db->fetch(RevSliderGlobals::$table_css);
foreach($styles as $key => $style){
$handle = str_replace('.tp-caption', '', $style['handle']);
if(!isset($this->class_include[$handle])) unset($styles[$key]);
}

$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);

if(!is_admin()){
echo addslashes($styles).'";
if(htmlDiv) {
htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
}else{
var htmlDiv = document.createElement("div");
htmlDiv.innerHTML = "<style>" + htmlDivCss + "</style>";
document.getElementsByTagName("head")[0].appendChild(htmlDiv.childNodes[0]);
}
</script>'."\n";
}
else echo $styles.'</style>';

}


But this is how it looks on output, using the web developer tools inspector:

var htmlDiv = document.getElementById("rs-plugin-settings-inline-css"); var htmlDivCss="";
if(htmlDiv) {
htmlDiv.innerHTML = htmlDiv.innerHTML + htmlDivCss;
}else{
var htmlDiv = document.createElement("div");
htmlDiv.innerHTML = "</p>
<style>" + htmlDivCss + "</style>
<p>";
document.getElementsByTagName("head")[0].appendChild(htmlDiv.childNodes[0]);
}


I'm far from a WordPress expert, and if I were I would probably not even be asking, but I've tried the

remove_filter( 'the_content', 'wpautop' );
remove_filter( 'the_excerpt', 'wpautop' );


...adding it either to the top of my functions.php or to the bottom of my functions.php (there seems to be no clear instruction on where one must add these two lines of code, or maybe it doesn't matter), and it never really works. I've also tried various plugins like Toggle wpautop, but as far as I have ever seen they don't do anything.

Answer

I'm not sure if this is what you're looking for. But you could in that template you wan't to show the slider use a rev slider shortcode for that. So, let's say you have it in frontpage.php then you could display it like this:

<?php putRevSlider("grill_accessories") ?>