# Pagination is displayed but doesn't work

**URL:** <https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125>\
**Category:** Pinegrow WP\
**Created:** [January 6, 2022, 9:27am UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125 "2022-01-06T09:27:57Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![veras](https://avatars.discourse-cdn.com/v4/letter/v/c57346/32.png) [@veras](https://forum.pinegrow.com/u/veras)\
**Post date:** [January 6, 2022, 9:27am UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/1 "2022-01-06T09:27:57Z")

</div>

Hi,  
I have set a loop with 4 posts. I have set pagination and it is displayed correctly. But when “next page” is clicked displayed posts remain the same. The page count does change though.

PG structure:

 ![Screenshot 2022-01-06 at 10.27.06](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/4/410a1858955fea4cc7390fd5344de9c5ff26bc19.png)

---

<div class="post-metadata">

**Author:** ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)\
**Post date:** [January 6, 2022, 11:25am UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/2 "2022-01-06T11:25:16Z")

</div>

Hi @veras,  
It is a little hard to troubleshoot from the information you have given. Can you give screenshots of your query post and post pagination actions, please?  
Thanks,  
Bob

---

<div class="post-metadata">

**Author:** ![veras](https://avatars.discourse-cdn.com/v4/letter/v/c57346/32.png) [@veras](https://forum.pinegrow.com/u/veras)\
**Post date:** [January 6, 2022, 11:44am UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/3 "2022-01-06T11:44:04Z")

</div>

Hello,

Thank you for looking!

This are screens:

 ![Screenshot 2022-01-06 at 12.42.59](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/d/d8174d54bb05058398fd06354a0fbf1d2a466e96.png)

 ![Screenshot 2022-01-06 at 12.43.11](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/4/4dc74546b419c587c2335fd2972cdae352c12108.png)

---

<div class="post-metadata">

**Author:** ![veras](https://avatars.discourse-cdn.com/v4/letter/v/c57346/32.png) [@veras](https://forum.pinegrow.com/u/veras)\
**Post date:** [January 6, 2022, 6:54pm UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/4 "2022-01-06T18:54:54Z")

</div>

Hm. I have moved whole section to new clean page … it works perfectly. Just have to find reason it doesn’t on previous page.  
I have copied whole page and export it as new template. I created new page in WP and applied template. It works like that.  
Is there any way to reset or clean whole PHP code from page with Pinegrow?

---

<div class="post-metadata">

**Author:** ![veras](https://avatars.discourse-cdn.com/v4/letter/v/c57346/32.png) [@veras](https://forum.pinegrow.com/u/veras)\
**Post date:** [January 7, 2022, 7:10am UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/5 "2022-01-07T07:10:47Z")

</div>

It looks like the problem appears whenever a page is set to “static home page” in WP. I replicated same problem with Oxygen builder.  
Could be the WordPress bug?

---

<div class="post-metadata">

**Author:** ![Emmanuel](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/emmanuel/32/6294_2.png) [@Emmanuel](https://forum.pinegrow.com/u/Emmanuel)\
**Post date:** [January 7, 2022, 10:04am UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/6 "2022-01-07T10:04:26Z")

</div>

I think you have found the origin of the problem.  
Post pagination = for posts/pages, not for a document which is defined as static I guess, since it is not intended to offer pagination.

---

<div class="post-metadata">

**Author:** ![RobM](https://avatars.discourse-cdn.com/v4/letter/r/278dde/32.png) [@RobM](https://forum.pinegrow.com/u/RobM)\
**Post date:** [January 7, 2022, 11:07am UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/7 "2022-01-07T11:07:20Z")

</div>

Hey @veras,  
Sorry, I was having some WordPress installation difficulties yesterday. Apparently Local can get fussy when you are low on disk space!  
First, I’m assuming this is the only loop on the page - Only the first loop called on a page can be paginated. If this is true then read on. If not, let me know - you can do a query swap and get it to work.

If the above ins’t true - I have been trying to figure out the most low-code way to do this in Pinegrow. In the newer versions of WordPress you have to changes up the `$paged` variable value in the query if it is a static page. The typical way to do it is an `elseif` loop. I _think_ your best option would be to copy the existing php for the loop above and paste it into a custom php block.

1. You can copy the code by clicking on the code symbol next to the trashcan at the top of the Show Posts - Smart title bar. Select all of the code except the `include` at the bottom.
2. Add the PHP code into the div that currently has the loop.
3. delete the loop action

Now for the code changes:  
The current code should start with:

```auto
<?php
    $query1_args = array(
        'post_type' => 'post',
        'posts_per_page' => 4,
        'paged' => get_query_var( 'paged' ) ?: 1,
        'order' => 'ASC',
        'orderby' => 'date'
    )
?>
<?php $query1 = new WP_Query( $query1_args ); ?>

```

So - I’m not sure how much PHP you know. But…

1. Before the first `<?php...?>` block you need to add in:

```auto
<?php 
if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); }
elseif ( get_query_var( 'page' ) ) { $paged = get_query_var( 'page' ); }
else { $paged = 1; }
?>

```

1. Within the first php block, change the `'paged' =>get_query_var('paged')?: 1,` to `'paged => $paged,`

I think that should be enough to get you going. The only thing that worries me is the include at the bottom. Those functions are probably included by some other aspect of your theme, but will cause a problem if not. Let me know.  
Bob

---

<div class="post-metadata">

**Author:** ![Emmanuel](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/emmanuel/32/6294_2.png) [@Emmanuel](https://forum.pinegrow.com/u/Emmanuel)\
**Post date:** [January 7, 2022, 12:05pm UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/8 "2022-01-07T12:05:00Z")

</div>

I have tested the case and I confirm that in a standard situation, the smart action Post Pagination is running fine.

Standard situation = From a post index page template and/or an archive page template.

 ![2022-01-07_13-03-52](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/5/5d6c34364bb8b3f007f92e094b74c64aa574df70.jpeg)

 ![2022-01-07_13-02-25](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/9/925f8a49c3c714844fc0e54e77f7012455431dba.jpeg)

---

<div class="post-metadata">

**Author:** ![Emmanuel](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/emmanuel/32/6294_2.png) [@Emmanuel](https://forum.pinegrow.com/u/Emmanuel)\
**Post date:** [January 7, 2022, 12:36pm UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/9 "2022-01-07T12:36:11Z")

</div>

Note: I have also successfully tested with a custom post type and a custom query 🙂

---

<div class="post-metadata">

**Author:** ![veras](https://avatars.discourse-cdn.com/v4/letter/v/c57346/32.png) [@veras](https://forum.pinegrow.com/u/veras)\
**Post date:** [January 7, 2022, 12:39pm UTC](https://forum.pinegrow.com/t/pagination-is-displayed-but-doesnt-work/6125/10 "2022-01-07T12:39:41Z")

</div>

Thank you both for input! I will rearrange home page - it looks like I will have to learn more PHP before tackling situations like this.
