Showing content dynamically

Hello,

I’m trying to figure out a way to integrate dynamic category modules on homepage,i will try to explain it wit the live use case,

Let’s say I’ve around 100 categories in Wordpress and out of these I want to display these 03 categories(Editorials,Tutorials,Unboxing) in homepage,I’m designing a block on homepage where I will have grids of these categories which will have relevant articles from respected category, now the issue is how to make this module completely dynamic?By dynamic I mean to say client should be able to change categories in these grids from Wordpress and once the category has been changed, automatically relevant articles form that category will be displayed.In this case if client wants to display iphone category inplace of unboxing then upon selecting the iPhone from Wordpress automatically unboxing articles should get replaced by iPhone articles and so does the name of the category.

what should be the proper approach to achieve this functionality with fronitity using gutenberg blcok or any otherway?

Thanks

Hey,

I am new here and not experienced, just read the docs and onboard with basic installation, but I think solution to your problem might be doing the following:

  • Using Advanced Custom Fields (ACF) to set the categories for homepage blocks (so the client can easily change them from WP)
  • Fetching these fields on frontity, and pulling their names, thumbnail, slug etc
  • Using the a custom component to show blocks with data populated from the above

Again as I said, not much experienced with Frontity and React, but this would be the approach I will use for such a problem. Rest I think the team can help with actual code?

I know we can use gutenberg blocks for this. But I need to know what is the proper way to achieve in frontity. And I don’t think we need to use ACF because categories are the part of core WordPress.

Thanks

I meant use of ACF just so the client can easily select and set the 3 categories that he wants at the WP backend. And then just fetching IDs of those category fields using ACF endpoints and then fetching data of those to show in the blocks.
Categories selected by client will still be a part of core WordPress, just that the client will be just selecting categories from a ACF dropdown and he won’t have to go to gutenberg block for it (where he might mess something up).

Although other experienced Frontity developers might be able to help in Gutenberg way. Curious to see their responses! :slight_smile:

@Shubham

Agreed! We can use ACF but that can be overhead sometimes and we want to resting on ACF. we are not using third party plugins except yoast SEO. and client is very familiar with Gutenberg so thats not an issue in my case. and WordPress directly gives any pages response in json so we can use in frontity. so I just want to know proper approach for the same.

Thanks :slight_smile:

1 Like

Hi @mosamlife

These two requirements seem to contradict one another. If the client needs to change things from WordPress then there’s isn’t necessarily a ‘proper way’ to do it in Frontity. What you need is the ‘proper way’ to do it in WordPress. If using a Gutenberg block in the homepage is giving you what you need and Frontity is rendering that, then that seems to be the best way to me as the client can control what appears by editing the page content from the WordPress side.

1 Like