Support

Home Forums Event Espresso Premium Stop EE4 from injecting code into loops

Stop EE4 from injecting code into loops

Posted: August 2, 2014 at 5:55 pm

Viewing 3 reply threads


Ryan DeBell

August 2, 2014 at 5:55 pm

I have several custom post types that use responsive grid systems, all of which do not display event espresso.

For some reason, they are now broken because event espresso appears to be injecting code into loops.

For example, below is a sample snippet of one of my taxonomy pages for a recipe custom post type:

<div class="section group">

<?php
if(have_posts()) :  
while(have_posts()): the_post(); 
?>

<div class="col span_2_of_4 recipe-block">
  <?php the_title();?>
</div>

<?php endif; endwhile; ?>

</div>

When displayed on an actual page, I can see in the source several injected event espresso elements:

<div class="section group">

<div id="espresso-notices" style="position: fixed; top: 234px; left: 551.5px; margin: 0px;"></div>	
<div id="espresso-ajax-loading" style="display:none;">
<span class="ee-spinner ee-spin"></span><span style="display:none;">loading...</span>
</div>

<div id="espresso-ajax-notices">
<div id="espresso-ajax-notices-success" class="espresso-ajax-notices success fade-away" style="display:none;">
<a class="close-espresso-notice">×</a>
<p class="espresso-notices-msg"></p>
</div>
		
<div id="espresso-ajax-notices-attention" class="espresso-ajax-notices attention fade-away" style="display:none;">
<a class="close-espresso-notice">×</a>
<p class="espresso-notices-msg"></p>
</div>
		
<div id="espresso-ajax-notices-error" class="espresso-ajax-notices error fade-away" style="display:none;">
<a class="close-espresso-notice">×</a>
<p class="espresso-notices-msg"></p>
</div>
</div>

<div class="col span_2_of_4 recipe-block">
  The Title
</div>

</div>

Is there anyway to disable this on a per post-type or template basis?


Ryan DeBell

August 2, 2014 at 5:56 pm

EE version is 4.2.9.p
WP version is 3.9.1


Brent Christensen

  • Support Staff

August 4, 2014 at 11:44 am

Hi Ryan,

You can add the following line of code:

add_filter( 'FHEE__EE_Front_Controller__display_errors', '__return_false' );

just above:

if(have_posts()) :

in your template and that should kill the errors.


Ryan DeBell

August 5, 2014 at 1:24 pm

Hi Brent, that worked exactly as required. Many thanks.

Viewing 3 reply threads

The support post ‘Stop EE4 from injecting code into loops’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso