Tell us what you are trying to do?
I have created a custom post type called Advertisements and one of its fields is a single image (see screenshot). I then set up a relationship where I can associate many ads to a single page (see screenshot). I need to create a slider that will display three ads at a time on the page and which scrolls horizontally automatically to show more ads. Can this be achieved using the view slider or do I need to integrate a 3rd party slider library? If so, which do you recommend?
Is there any documentation that you are following?
I've tried to find a solution to this in the knowledge base, but haven't found anything that addresses the relationship feeding the slider images on a page
Is there a similar example that we can see?
N/A
I have provided screenshots of the advertisement post type and the many ads to one-page relationship
Hello and thank you for contacting the Toolset support.
This can be totally done with Toolset. As you have mentioned the view slider, I assume that you are building using Blocks(Gutenberg editor), right?
You can define the number of columns on the slides in the styles section. In the content selection, you can add a query filter on the posts related to the page where this slider is used.
If you can't get it done, allow me temporary access to check this for you. Or let me know and I'll create a test site on our platform to show you how. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
I confirm the credentials are working for me. I checked some pages and I could not find anyone that has related ads. Can you give an example page to test with it?
For whatever reason, ads that were created before my recent Toolset update to the latest version are no longer able to be associated to pages. If I create new Advertisements, they work fine. Something in the toolset update seems to have broken the older ads somehow, even though the posts still exist, they cannot be associated to pages. I created 2 new ads (and will create another) for you to test with and a page called Test Page with Ads.
Please note that I have disabled performance optimizations and caching (WP-Rocket, Cloudflare) while you are working on this to try and head off any trouble you might have testing while the caches are enabled. Also, please feel free to create more Advertisement posts and associate them to the test page I created if needed for testing purposes.
My apologies, but it turns out that the Image Slider Block does not pull the images from a list of posts(related posts) it only works on repeatable image fields.
But we can still build a view of related posts and choose it to be a grid of 3 posts, with a limit of 3 posts, so we don't get several rows.
Currently, we can't build a view with the block editor without doing it inside a page, a post, or a content template. I tried to create a content template and create a view inside of it. But it does not get saved. Check this screenshot hidden link
You may want to try to build it in the legacy editor, you can use any Javascript slider library you prefer. I prefer to use slick hidden link
If you want us to investigate why the content template is not saving, please turn PHP debugging in and try to create a view inside of this content template hidden link
If it does not get saved, please check again when:
- Only Toolset plugins are activated. It will tell us if there is an interaction issue with another plugin.
- The theme is set to a WordPress default like Twenty Fourteen. It will tell us if there is an interaction issue with your theme.
If the problem disappears, start activating one at a time to track where the incompatibility is produced.
Thanks for your assistance with this and for the slick library recommendation. I was struggling to use the owl carousel in my theme due to jquery versioning issues, but the slick slider runs great when manually integrated into a WordPress theme. I may need to have you guys look into the content template saving problem, but for this ticket I'm going to stay focused on building the ad rotator. I have a prototype of the slick slider working now and was wondering if there is a way I can query for the associated ads (and the image field on each) directly in WordPress. I'd like to just write my own plugin code that outputs the slick slider. For example, can I query for them using the WordPress post object and a toolset API? I may choose to use a toolset content template for this in the end, but I'm trying to get this done quickly for the client and then will circle back around on the content template saving problem you encountered.
I am sure you are asking about our relationship api, especially, the toolset_get_related_posts function https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
Let me know if you need anything else.
I was able to build the desired slider by integrating the recommended slick carousel plugin with my theme and then creating a view and content template, using the wpv-loop to output ads as repeated items in the slider. It's working perfectly and with nice responsive behaviors from the slick library. Thanks for the support!