Assigning archive layout to homepage

Hi all,

I’ve created a custom ‘archive’ layout view for the site blog page, with recent posts and post pagination. That works great.

What I’d like to do is have a version of this layout view on the homepage. I’ve created a new layout view based on the first one I created. However I can’t see how to assign this view to the homepage. I’ve tried pretty much every option in the settings->Conditions dropdown, but nothing seems to work.

Can you point me in the right direction?

Howdy, @KEXINO…thanks for writing in and great question! This particular setup you’re after is definitely achievable, it just requires one extra step due to some of the weirdness with how WordPress handles these things.

The first thing you’ll want to do is create your Archive Layout and assign it to your “Blog.” It sounds like you’ve already explored this, but just to be completely sure, your assignment condition should look like this:

Next, you’ll need to go into the WordPress admin and go to SettingsReadingYour homepage displays, where you should see a radio select to choose between “Your latest posts” and " A static page." Most people use the static page option because they want to show a page for their site’s homepage, but in your case you will want to make sure that “Your latest posts” is selected, like so:

This will place your “Blog” on your site’s homepage, and once you have both of these settings in place, you will start seeing your Archive Layout on the actual homepage of your website as you are intending. Hopefully that all helps to point you in the right direction…cheers!

Thanks for getting back to me so quickly. Since the header of the homepage is different to the rest I’m going to have to create a new header and assign it to that page. I’ll come back to you if I have any problems. Just to confirm: the archive layout for the Blog page is different to the archive layout I want for the homepage. That’s possible, right?

One other issue I’m having is that the post pagination element isn’t working correctly. I have around 500 posts and am outputting 20 posts/page, as per the WP “reading” settings.

On the outputted page, if I hover over one of the pagination links the right URI appears. However if i click on a post pagination link to bring up (for example) page 10 of the archive, the page shows the same post data from page 1 of the archive

I initially thought it was an issue with the post pagination element not receiving data. Since you can’t directly make the post pagination element a Looper Consumer, I created a div element, made the div element a Looper Consumer, and put the post pagination element into it. However that didn’t work. Anyway, the element must be getting the WP query data, otherwise it wouldn’t paginate and show the links, right?

What am I doing wrong?

Screen Shot 2021-03-03 at 5.37.00 PM

Hello @KEXINO,

Just to confirm: the archive layout for the Blog page is different to the archive layout I want for the homepage. That’s possible, right?

  • If you have set a different page as your homepage, you will need to create a separate page which is for the homepage. It does not necessarily need to be an archive layout since your homepage will be a static page.

To better assist you with your issue, kindly provide us access to your site so that we can check your layout looper and pagination element settings. Please create a secure note with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

Thanks. Secure Note added here.

Hi @KEXINO,

The reason behind the issue is the looper and post pagination elements are not connected. I would like to request you to check the following videos that will help you on the loopers.




Please find more details on the Pagination, here in this article: https://theme.co/docs/pagination
I went ahead and created another layout using Flat Dark premade template which has the pagination with it, and it works fine while assigning it to the blog page. I would suggest you check it once and change the design according to your need.

Hope it will help.
Thanks

Thanks for getting back to me.

I had watched those videos prior to contacting you.

You say the looper and post pagination elements are not connected, but you don’t mention how I should connect them. I tried making the parent column a Looper Provider so that (I’m assuming) every element within it would receive the WP query data, but the post pagination element still doesn’t work the way I expect.

Hey @KEXINO,

  1. I would like the archive layout named “KB_ARCHIVE LAYOUT” to be assigned to the Blog page. FYI in the WP back end the blog page is called “Knowledge Base” (WP post ID is 180)

All you have to do is to assign the “KB_ARCHIVE LAYOUT” to be the archive layout for your Knowledge Base page.

  1. Separately, I would like the archive layout named “KB_ARCHIVE_LAYOUT HOMEPAGE” to be assigned to the homepage.

Please understand that since you have assigned the homepage and posts page in Settings > Reading, your homepage, the “Evaluate. Optimize. Grow”, is a static page and not an archive. This means that you cannot use the archive layout for a normal page.

  1. In addition, the post pagination element for both of these archive layout pages isn’t working correctly.

The post pagination will only work for the archive layout. In your “KB_ARCHIVE LAYOUT” layout, it is not working because you have a looper. An archive itself contains a loop which is why you do not need to add a Looper Provider. The archive layout only needs a Looper Consumer since the archive is already a loop by itself.

I went ahead and fixed #1 and #3 already. As for you #2, it is not possible to use the archive layout as your homepage while you also have a page assigned as your Posts Page. We highly recommend that you edit your home page which is the “Evaluate. Optimize. Grow” page. Do not put pagination. What you can do is to only list a few items and then a button that will be linked to the Knowledge Base page.

Hope this makes sense.

Thanks for clarifying that an archive layout already has a looper provider contained within it. I wasn’t aware of that.

I take it there’s no way to make the homepage an ‘archive’ page, right?

Also, thanks for fixing the homepage and blog page. However, on the blog page the post pagination element still doesn’t work. If I click on (for example) page 2 of the pagination links, the same blog articles are shown.

Hi @KEXINO,

If you set a Static Page as a Home Page it can’t be an Archive page, alternatively, you can use the Single layout for that. The reason behind the pagination won’t work is the looper and post pagination elements are not connected. The predefined template chosen in the Layout you are using is not coming with the pagination, for now, pagination and the navigation element works with only a few pre-defined templates. I would request you to use the Layout which I built and you need to adjust the style to match the design.

Hope it helps.
Thanks

Thanks so much for your help.

I adjusted styling for the page you created, and everything is working great!

You’re welcome.

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