# Smart Action "Show Posts" for Archive: Wrong per-page post count \[fixed\]

**URL:** <https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975>\
**Category:** Pinegrow WP\
**Created:** [April 27, 2023, 6:56am UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975 "2023-04-27T06:56:21Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![MichelyWeb](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/michelyweb/32/6652_2.png) [@MichelyWeb](https://forum.pinegrow.com/u/MichelyWeb)\
**Post date:** [April 27, 2023, 6:56am UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/1 "2023-04-27T06:56:21Z")

</div>

Creating an index.php for archives.  
The loop shows one more post per page than set in WordPress settings.

 ![CleanShot 2023-04-27 at 08.52.46@2x](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/8/801f099c5a87293a2cb538e3eefad66c9b58a091.png)

Demo as [screen recording](https://share.cleanshot.com/lwhLqCzt) (available for 30 days)

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [April 27, 2023, 1:27pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/2 "2023-04-27T13:27:05Z")

</div>

Can you send a link to your project or paste the HTML from your template in here so we can get a better idea of how you created this? Off the top of my head, I would guess that you have a placeholder card that you forgot to add the “do not export” action to, but that’s purely a guess based on boneheaded things I tend to mess up.

---

<div class="post-metadata">

**Author:** ![MichelyWeb](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/michelyweb/32/6652_2.png) [@MichelyWeb](https://forum.pinegrow.com/u/MichelyWeb)\
**Post date:** [April 27, 2023, 3:06pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/3 "2023-04-27T15:06:44Z")

</div>

Here’s a screenshot of the structure panel:

 ![CleanShot 2023-04-27 at 17.04.27@2x](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/2/27fbc76b29a86c91c16a1175be51d2336b5c0370.png)

The code:

```auto
<div class="container content-gap">
    <h1 cms-function="code" cms-function-type="content" cms-function-code="the_archive_title()">Archive Title</h1>
    <div cms-post="loop" cms-post-first-classes="card-post--first" cms-post-items-container=".archive-grid" cms-post-repeat=".card-post" cms-post-show-empty-element=".width-full">
        <ul class="archive-grid">
            <li class="card-post">
                <div class="card-post__media">
                    <figure>
                        <img src="https://pinegrow.com/placeholders/img10.jpg" class="card-post__image" loading="lazy" cms-post-image="medium">
                    </figure>
                </div>
                <div class="card-post__content">
                    <div class="card-post__content-left" style="flex-direction: column; display: flex;">
                        <h2 class="card-post__heading"><a href="" cms-post-link="not_singular" class="clickable-parent" cms-post-title>Post Heading</a></h2>
                        <p class="card-post__text" cms-post-excerpt>This is a paragraph, one or more lines of text. Each paragraph is displayed in a new line.</p>
                    </div>
                    <div class="card-post__content-right" style="display: flex; flex-direction: column; align-items: center;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 96 960 960">
                            <path d="m304 974-56-57 343-343-343-343 56-57 400 400-400 400Z"/>
                        </svg>
                    </div>
                </div>
            </li>
            <li class="card-post" cms-no-export>
                <div class="card-post__media">
                    <figure>
                        <img src="https://pinegrow.com/placeholders/img10.jpg" class="card-post__image" loading="lazy" cms-post-image="medium">
                    </figure>
                </div>
                <div class="card-post__content">
                    <div class="card-post__content-left">
                        <h2 class="card-post__heading"><a href="" cms-post-link="not_singular" class="clickable-parent" cms-post-title>Post Heading</a></h2>
                        <p class="card-post__text" cms-post-excerpt>This is a paragraph, one or more lines of text. Each paragraph is displayed in a new line.</p>
                    </div>
                    <div class="card-post__content-right" style="display: flex; flex-direction: column; align-items: center;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 96 960 960">
                            <path d="m304 974-56-57 343-343-343-343 56-57 400 400-400 400Z"/>
                        </svg>
                    </div>
                </div>
            </li>
            <li class="card-post" cms-no-export>
                <div class="card-post__media">
                    <figure>
                        <img src="https://pinegrow.com/placeholders/img10.jpg" class="card-post__image" loading="lazy" cms-post-image="medium">
                    </figure>
                </div>
                <div class="card-post__content">
                    <div class="card-post__content-left" style="flex-direction: column; display: flex;">
                        <h2 class="card-post__heading"><a href="" cms-post-link="not_singular" class="clickable-parent" cms-post-title>Post Heading</a></h2>
                        <p class="card-post__text" cms-post-excerpt>This is a paragraph, one or more lines of text. Each paragraph is displayed in a new line.</p>
                    </div>
                    <div class="card-post__content-right" style="display: flex; flex-direction: column; align-items: center;">
                        <svg xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 96 960 960">
                            <path d="m304 974-56-57 343-343-343-343 56-57 400 400-400 400Z"/>
                        </svg>
                    </div>
                </div>
            </li>
        </ul>
        <div class="width-full" cms-template-part="template-parts/no-results">
            <p>Placeholder: Keine Ergebnisse</p>
        </div>
    </div>
    <div class="pagination-wrapper" cms-template-part="template-parts/pagination">
        <p>Placeholder: Pagination</p>
    </div>
</div>

```

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [April 27, 2023, 3:34pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/4 "2023-04-27T15:34:34Z")

</div>

Okay, this is going to drive me batty…

I just checked my template and it’s doing the same thing. To make it even more interesting, I switched to a vanilla [Underscores](https://underscores.me/) theme, which also shows one more than what’s in the Reading settings in WordPress. Both Underscores and Pinegrow use a similar loop structure, which is also the same thing you’ll find in the WP Codex.

That tells me that it’s not a Pinegrow thing, but some WordPress oddity that I’m missing.

Maybe someone smarter than me knows the answer here.

Here is the relevant code from Underscores

```auto
		<?php
		if ( have_posts() ) :

			if ( is_home() && ! is_front_page() ) :
				?>
				<header>
					<h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
				</header>
				<?php
			endif;

			/* Start the Loop */
			while ( have_posts() ) :
				the_post();

				/*
				 * Include the Post-Type-specific template for the content.
				 * If you want to override this in a child theme, then include a file
				 * called content-___.php (where___ is the Post Type name) and that will be used instead.
				 */
				get_template_part( 'template-parts/content', get_post_type() );

			endwhile;

			the_posts_navigation();

		else :

			get_template_part( 'template-parts/content', 'none' );

		endif;
		?>

```

---

<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:** [April 27, 2023, 4:01pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/5 "2023-04-27T16:01:17Z")

</div>

I don’t have this problem. 3 posts in the settings, 3 posts on the frontend.

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/6/633d68aae1719a3dc4f6e429f6e4d47fcf5b9765.jpeg)  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/3/3b5d00e0e8127668fdaa08d8ec81a3a525c23738.png)  
 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/7/7e7e7f9d7d9e8d8921d9ea73318501b60f595409.jpeg)

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [April 27, 2023, 4:23pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/6 "2023-04-27T16:23:30Z")

</div>

I just noticed that GeneratePress also has this issue… I have to be missing something obvious!

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/c/cc91b8d7e157aef41cfba11bcdec9475c43e79b4.png)

 ![image](https://canada1.discourse-cdn.com/flex036/uploads/pinegrow/original/2X/a/a45cfbcc886fbfdab1a7d0b7f123f947236b4ef5.png)

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [April 27, 2023, 4:26pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/7 "2023-04-27T16:26:03Z")

</div>

Oh crap… in my tests, I have a sticky post. Those get added to the loop in addition to the post count. Could that be what you are seeing, @MichelyWeb?

---

<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:** [April 27, 2023, 4:29pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/8 "2023-04-27T16:29:30Z")

</div>

it seems we might have found the root cause of your issue. 🙂

---

<div class="post-metadata">

**Author:** ![adamslowe](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/adamslowe/32/4590_2.png) [@adamslowe](https://forum.pinegrow.com/u/adamslowe)\
**Post date:** [April 27, 2023, 4:30pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/9 "2023-04-27T16:30:38Z")

</div>

Don’t worry, I have plenty more issues, and I’m sure they all have different root causes. 😃

---

<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:** [April 27, 2023, 4:36pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/10 "2023-04-27T16:36:38Z")

</div>

@adamslowe Oh, I reassure you, I also regularly encounter situations where the rate of annoyance is inversely proportional to the simplicity of the cause …

And this, without even wanting to use the trendy features of WordPress!!

---

<div class="post-metadata">

**Author:** ![MichelyWeb](https://yyz2.discourse-cdn.com/flex036/user_avatar/forum.pinegrow.com/michelyweb/32/6652_2.png) [@MichelyWeb](https://forum.pinegrow.com/u/MichelyWeb)\
**Post date:** [May 5, 2023, 10:58am UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/11 "2023-05-05T10:58:26Z")

</div>

You’re right @adamslowe - I also have imported the theme test content and there is one sticky blog post. Did not know that sticky posts are counted _on top_ of the query results. That’s weird behavior by WP IMHO.

Thanks so much guys!

---

<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:** [May 5, 2023, 12:14pm UTC](https://forum.pinegrow.com/t/smart-action-show-posts-for-archive-wrong-per-page-post-count-fixed/7975/12 "2023-05-05T12:14:14Z")

</div>


