Content injected via ‘the_content’ filter should only appear in one panel

Asked on March 6, 2016 in Development.

We are using Mooberry Book Manager plugin, and we want to display a book grid on our front page.

We have three Layers columns on our front-page (in fact two slider panes and one column which appears below).

Unfortunately Mooberry puts a book grid in all three of these panels!

This is because Mooberry triggers on ‘the_content’:

add_filter('the_content', 'mbdb_content');

so the function is triggered three times.

(In an earlier version, I added this check inside the mbdb_content function:

if ( !in_the_loop() || !is_main_query() ) {

return $content;


But in our current version that shows zero grids, so I have removed it.)

I want to display one grid in only one of the panels (the last panel in fact).

So my questions are:

– Is there any way to tell which Layers panel/column we are in when the mbdb_content function is called?

– Or is there a better way I should approach this?

TIA. (We just bought LayersPro but we haven’t unlocked it yet.)

jt99 Layers User
1 Answer(s)
Answered on March 7, 2016.

Hi there,

It is better to create a shortcode that calls this function, then use it in the widget where you want that grid to appear. If the issue is in the post widget, ensure posts have an Excerpt entered in them which you do not want to output other stuff in excerpted areas. The excerpt, if it exists, will always output first.