Custom Slider to be reused within the pages

Hello everyone!
I need to create a Wordpress theme, there will be a page that will contain kind of movies within different sliders divided by category.

Below is an example of the structure with 2 kind of movie

I have already done the programming part in JS for the sliders, and I also figured out how to make a query on the categories in the posts (using The Loop)

Now I have a number of problems to solve.

  1. the sliders must also be used in other pages, so I should make a kind of component that is called up by the pages or a kind of block to reuse (I don’t know how to make it)
  2. how will the card containing the image, title, short description and duration be populated? Will the data be in a post? I don’t know how to take the image as an example (it will not be a featured image but an image inserted in the post). Will I have to use Wordpress custom fields? (I didn’t understand how to do it and couldn’t find any examples or tutorials)

Sorry for my English, if anyone can help me I would appreciate it. Even just pointing me to tutorials that I couldn’t find.

Thanks to all in advance

Hello superfabiuz,

  1. In Pinegrow you find reusable components under “template parts”.
    On your component you first need to set the “define template part” action and also the “include template part”. That “define template part” will create a php file with the slug name you choose, containing your component. And the “include template part” action will call that template.
    On all the other pages you only have to add the “include template part” action.

grafik

  1. Your custom query will contain the data you need. So you can use the smart action “Post Title”, Post Excerpt” and “Post Content”. If the post content only contains the image than you are fine. If not, you could define a custom field in WP and call that by using the “Post Field” action.

Good luck!

2 Likes

Thank you so much for the advice, I’ll try to do as you told me.

Thanks again @Erres, I think I understand the functioning of “Post Field” and “ACF” and “template parts”. I have done several tests and everything works correctly.

But maybe I still have some gaps regarding the WordPress templates hierarchy. I am missing something and I cannot understand, maybe you could help me.

What I have to do now is a template page for the detail of the single film, a detail sheet of the film. So in the articles there are already all the fields I need (title, description, video url, poster image and so on) for each article (film).
The detail page contains all the fields related to the article, but what kind of query should I do so that the page shows the data relating to the article I clicked in the slider?

I hope I was clear even though I definitely wrote in incorrect English.

Thanks

Hi Fabio,

I’m not certain if I understand your question correctly. Nevertheless I hope that the following brings you further.
If your custom query gives you the information about the films in your horror category, you can
get the link to the details of a specific horror-film with a “post link” action. Just add this smart action to an element in that part where you show the custom query results. And if you have created a file for the horror category, named “category-horror.php” (with its own smart action “Show Post” for the main loop) than WP will use that when that link is used. Otherwise WP will go down the hierarchy to search another template.
René

1 Like

Thanks a lot @Erres, it works perfectly
Fabio