How to show recent post in Hompage?

Hey, i’m new to Frontity (and react too) and was trying out it on one of my project.

Can any when guide me on how to display say 3 recent posts in Hompage (i have selected static Homepage and there is a section to display recent blog posts) and also under individual posts?

Hi @Varma,

Welcome to the community!

In order to help you better with your project please provide the info suggested here

The package @frontity/wp-source is the one in charge of getting the data from your REST API and putting it into the state so you can access these data from your React components

If you have changed the homepage in your WP you may have to change these settings in your frontity.settings.js:

In Frontity (thanks to @frontity/wp-source), you also have available:

  • the actions.source.fetch the
    method that allows you to do specific requests to your REST API
  • handlers which you can use to define custom links to be fetched that perform custom requests to any REST API

Hope this helps

1 Like

Thanks for the quick reply :wink:

Yes i have set different pages for homepage and postsPage in Frontity settings.

Now i’m trying to get 3 recent post to be shown as asection in the home in additon to all the static content i have.

I think when Frontity loads it already have the posts fetched and stored? How can i use that instead of requesting again tothe REST API

1 Like

Hi @Varma, Please is you done the code implementation share it with us if possible. Thanks

1 Like

@zaid_sameer couldn’t make it work till now.

@juanma not able to make it work.

Description of issue i’m facing: Would like to show 3 recent posts in the homepage and serveral other pages (like about page and services page that i define in WordPress. (have used seperate homepage and post page in wp and defined that on Frontity settings)

1 Like

Hi @Varma,

Please share a repository or code-sandbox with your code

In the post below we explain the info we suggest to provide in order for the Frontity team and the community to provide the best possible help as quickly and as efficiently as possible