"The Grid" plugin not displaying on pages, only posts

I have created an image gallery using “The Grid” plugin.

It works fine when inserted into a post, but when I insert the exact same thing into a page it tells me that it could not find any images because my settings are too strict.

Why does it work on posts but not pages? How do I fix that?

Hey There,

​To assist you better with this issue, would you mind providing us the url of your site with login credentials so we can take a closer look? This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.

To do this, you can create a secure note with the following info:
– Link to your site
– WordPress Admin username / password

Thank you.

Thanks for the help.

Please see the attached notes for login info.

Hi there,

I added a different grid and it works just fine, do you have customization that laters WP Query of the grid? It’s the only explanation I could think since it’s related to the post count is being zero. And it only happens on that grid. Please try creating the same grid (with the intention of having different internal ID) and test it again.

Thanks!

As you suggested I created a new grid for testing named “New Test Grid” and I pin pointed the problem to the image category filter.

If I have the image category filter (currently set to “Coloring Pages”) turned on it will not display the images if the grid is inserted into a page. But it will work just fine when the grid is inside a post. So the problem is something to do with using the image category filter while using the grid inside a page.

Here is a short screencast showing the problem: http://nimb.ws/t3xWy2

Hi there,

Thank you for the information. I did test the case on my local installation and it is working ok with no problem. I set the Post Type to be Media Library and I assigned a Category Filter and it shows with no problem.

The same thing is not showing in your installation. I added a Test Page on your installation and it does not show the images.

The difference is that I used The Grid version 2.6.0, but you are using the version 2.5.5.

Please make a complete backup of your website and delete The Grid plugin from your installation. Then Go to X > Validation and install it again from the Extensions section of that page and enable the plugin.

If you still have the problem please deactivate all plugins except Cornerstone and The Grid and test the case.

Also please deactivate the CloudFlare and change it to the devloper mode for your testing.

Thank you.

Ok I followed your advice and found out it was a piece of code in my functions.php file that was causing the problem. The code below is supposed to hide password protected posts form the blog loop, but it excluded The Grid on pages also for some reason.

/* Hides protected posts from wordpress loop - archives, blog page, etc */

function wpb_password_post_filter( $where = '' ) {
    if (!is_single() && !is_admin()) {
        $where .= " AND post_password = ''";
    }
    return $where;
}
add_filter( 'posts_where', 'wpb_password_post_filter' );

Do you know what this is causing a problem and how to change it?

I have never had a problem using that code with any other plugin.

Hi There,

Could you please try updating your custom code to this?

/* Hides protected posts from wordpress loop - archives, blog page, etc */

function wpb_password_post_filter( $where = '' ) {
    if (!is_single() && !is_page() && !is_admin()) {
        $where .= " AND post_password = ''";
    }
    return $where;
}
add_filter( 'posts_where', 'wpb_password_post_filter' );

Let us know how it goes!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.