Problem with showing posts [Solved]

Problem with showing posts on Home page and News page ( archive or archive-(…).php )

Show 3 last post on Home (index page)
Show 6 posts on News (archive page)
3 last posts on home page added (ok)
6 posts on News archive (failed) - it shows the same as the Home page (3 posts)

This is not my first site and this is the first time I encountered this problem…
Has anyone the same problem?

@Roxy Can you please send your project folder to the support so we can check your templates?

IMPORTANT: Please do not send a direct link to one of our email addresses from the sharing service but rather create a private SHARE LINK from Google Drive, Dropbox or WeTransfer which you will then copy into your reply to us.

If possible, please do not set an expiration date on your file share. We cannot guarantee that we will be able to view your files immediately after you send them.

Hi Emmanuel.

Thx for reply. I already sent to support. I am in contact with Matjaz but I haven’t received a reply to the last email for some days (I’m in a bit of a hurry)…can I ask you please to try this process (it takes you five minutes :slightly_smiling_face:)

1.making index.html (which will be index.php) - shows 3 x posts
2.making some.html (which will be archive.php) - shows 6 x posts

It would really help me if you could try.


@Roxy If I understood the problem correctly, here is my test (which took me more than 5 minutes)

Thank you very much Emmanuel for your kindness.

I have the same settings (the only difference is I didn’t wrote “post” in archive page under Show post smart - Post type … but as I know it is by default)

And the second…in wp dashboard I did the news page - selecting the news template - and in Reading I selected - Posts page: News

If I watched the url was ok /news but posts they were the same as on the home page (only 3 and not 6)

just in case, here is the archive of my test project.

Thanks Emmanuel.

I want to upload my settings video. In which format is it possible to upload?

My test…

@Roxy Can you install Query Monitor and show us/me what you see?

Sorry for my late reply…this is on news page

Home page…

And this is my archive.php file from wp…

@Roxy As you can see, both views use the same template > index.php
So you are “calling the wrong view” hence the same content.

Take a look at my example and also read about using archive.php in your WordPress themes and you should be able to get a better understanding of the situation and solve your issue :slight_smile:

Ok…Thx Emmanuel…just one last question…
but if I want to display all posts (default posts) in some page with pagination (let’s say we call it News or Posts)…which .php name I have to use…
I think archive.php or I’m wrong…

(as in my example) The archive template is used when visitors request posts by category, author, or date. Note : this template will be overridden if more specific templates are present like category.php , author.php , and date.php .

For your need, you can build any page template and use a custom query so you can display exactly what you want. (What is important is how you call to the corresponding page)

Thank you very much, Emmanuel.

@Roxy Something like

This situation gave me the opportunity to introduce you to Query Monitor which is a perfect complement for any WordPress developer. Here we could use it to (easily) determine that the view was not using the right template. (examining the displayed code could also have given this information, but here it is presented in a visual way)

Switching your site to debug mode is also very useful to see all the possible problems in your templates.

Yes very useful…thanks
About a year ago i was making a website and used archive-news.php for default wordpress posts with template News with pagination and everything was ok…and it still works today…

archive-{post-type}.php (classic theme)

The archive post type template is used when visitors request a custom post type archive. For example, archive-books.php would be used for displaying an archive of posts from the custom post type named books. The archive template file is used if the archive-{post-type} template is not present.

And so on.
More about WordPress template files : Template Files | Theme Developer Handbook | WordPress Developer Resources

But your main concern in this case, I remind you, is that you don’t seem to call the right document. Not that archive.php is problematic.