Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1407157

    Chgrim
    Participant

    Hi,

    If you check out my page here https://www.topdownreviews.com/los-angeles-immersive-theater-reviews/

    You can see that I have 3 grids on that page that are all loading the same thing. The issue I am having right now is that it repeats the first post twice, once as the big image at the top of the page then again in the list of posts below. How do I tell the Grid below to skip the first post?

    Thanks for all your help!
    Chris

    #1407629

    Lely
    Moderator

    Hello Chris,

    The page has one grid only when I check and of course no duplicates.
    Although regarding your question, there’s an option to exclude a post. See this:https://theme-one.com/docs/the-grid/ See exclude part. I did attached a screenshot.

    #1407658

    Chgrim
    Participant

    Hi,

    The exclude a post doesn’t really seem like it would work for me since I have to use a post id to exclude. I don’t want to have to update the id every single time I add a new post. I am looking for a way to automatically exclude the latest post.

    Also the page has 3 grids, [the_grid name=”LAimmersivemain”] [the_grid name=”laimmersivemobile”] and [the_grid name=”laimmersivemaintmobile”]. One of them is the big banner image, the other is the mobile big banner image and the final is the grid of images.

    Thanks
    Chris

    #1408139

    Lely
    Moderator

    Hi Chris,

    In that case, it can be achieve using a little custom function. See this thread for guidance:

    Offsetting Posts with The Grid Plugin


    Change 10 to the number of post you want to bypass.

    Hope this helps.

    #1408250

    Chgrim
    Participant
    This reply has been marked as private.
    #1408271

    Chgrim
    Participant

    nm it seems to be working now!

    Thanks
    Chris

    #1408320

    Chgrim
    Participant

    Sorry to keep bouncing back and forth, but it that code actually broke something else. When I press the load more button at the bottom of the grid it reloads the same posts over again.

    https://www.topdownreviews.com/los-angeles-immersive-theater-reviews/

    Thanks
    Chris

    #1408951

    Rad
    Moderator

    Hi Chris,

    Try increasing your grid’s Item Number, it’s currently set to 9. Or disable the “load more” feature. There nothing to load at all since you’re displaying 9 items and the limit is 9 (there is no 10th, 11th, etc..)

    Or set Item Numbers to -1 to make sure it picks all the post.

    Thanks.

    #1409868

    Chgrim
    Participant

    Hi,
    I’m pretty sure the item number displays how many posts are in the displayed grid. There are actually 21 posts in that category but you have to click on the load more button to show more of them. This was working fine until I added the code

    function my_query_args($query_args, $grid_name) {
    
        if ($grid_name == 'laimmersivemobile') {
            // all query parameters can be modified (https://codex.wordpress.org/Class_Reference/WP_Query)
            $query_args['offset'] = 1;
        }
        
        return $query_args;
        
    }
    
    add_filter('tg_wp_query_args', 'my_query_args', 10, 2);

    to accomplish what I was asking earlier in this thread.

    If you check out the grid here https://www.topdownreviews.com/what-to-buy/ you can see how the load more is supposed to work.

    What I want to know is how to fix that code above so that it keeps offsetting my first post but doesn’t break the load more button.

    Thanks so much!
    Chris

    #1410537

    Rad
    Moderator

    Hi there,

    You’re right, looks like the “load more” is sending wrong pagination number. Please change your code to this

    function my_query_args($query_args, $grid_name) {
    
        if ($grid_name == 'laimmersivemobile') {
            // all query parameters can be modified (https://codex.wordpress.org/Class_Reference/WP_Query)
            $query_args['offset'] = 1;
            if( isset($_POST['grid_page']) )  {
                   $query_args['paged'] = (int) $_POST['grid_page'] + 1;            
            }
        }
        
        return $query_args;
        
    }
    
    add_filter('tg_wp_query_args', 'my_query_args', 10, 2);

    Please provide your FTP login credentials as well so I could troubleshoot it.

    Thanks!

    #1410660

    Chgrim
    Participant

    I added that to my functions but it still doesn’t seem to be working.

    Is it working on your end?

    Thanks
    Chris

    #1411359

    Chgrim
    Participant
    This reply has been marked as private.
    #1411429

    Rad
    Moderator

    Hi there,

    What I need are your FTP login credentials. I can’t just add it through admin, if it breaks or failed in saving then your site will be down.

    Thanks!

    #1411526

    Chgrim
    Participant
    This reply has been marked as private.
    #1412290

    Rad
    Moderator

    Hi there,

    Thanks, it’s stuck with “connecting”. Does it have firewall that blocks users? Please check, and if you have CPanel with file manager then it should be okay than FTP.

    Thanks!