Skip Navigation

[Resuelto] How to create slider from repeating field in a CPT & display in a Content Layout

This support ticket is created hace 7 años, 6 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Etiquetado: ,

This topic contains 4 respuestas, has 2 mensajes.

Last updated by Minesh hace 7 años, 6 meses.

Assisted by: Minesh.

Autor
Mensajes
#445818

I have a CPT (Care Homes) which has a repeating image field in it.

I wish to display the images from the repeating field in a slider which is embedded in a Content Template. The Content Template will be used on various pages and should display the Slider and other fields from the CPT.

I have looked at lots of 'solutions' in the Support Forum, but none have worked for me.

My scenario is this:-

I have created a View which loads the CPT (Care Homes) with a Query Filter "Include only posts with IDs set by the View shortcode attribute "ids" eg. [wpv-view name="view-name" ids="1"]

I then edited the Content Template for the auto generated "Care Homes - Slide" to have the following code:-

[wpv-for-each field="wpcf-care-home-images"]
 <li>
  <img src="[types field="care-home-images" separator=", " output="raw"][/types]" alt="[wpv-post-title]">
</li>
[/wpv-for-each]

I then added the View to my Content Template:-

[wpv-view name="care-home-slider" ids="[wpv-post-id]"]

…but I get the message "No items found"

Any ideas why this would not be working?

#446033

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I need to check on your install, why it's not working but before you share temporary access details with me:

1)
Could you please try to resolve your issue by deactivating all third-party plugins as well as the default theme to check for any possible conflicts with any of the plugins or themes?

2)
If #1 does not help:

Please share problem URL where I can see slider you added not working.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#446116

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thank you for sharing information.

Actually, you passed wrong ID:

You used following shortcode:

[wpv-view name="care-home-slider" ids="[wpv-post-id]"]

You added this shortcode to page's content template and at this point when you use [wpv-post-id], it will return you the page ID where you've added the view's shortcode using content template.

I changed above shortcode as given under:

[wpv-view name="care-home-slider" ids="517"]

Where 517 is your your 'Oakwood Park' post ID.

We have again detailed Doc how you can build sliders using view:
=> https://toolset.com/documentation/user-guides/creating-sliders-with-types-and-views/
=> https://toolset.com/documentation/user-guides/getting-started-views/part-5-slider/

You can follow above tutorials and if still it not work you should check with default theme and only toolset plugins.

#446120

Hi Minesh,

Thanks for that info. Yes, I tried adding in the actual ID as you have done (I have seen these tutorials and they are very helpful), but I would have to add the individual CPT ID on each page I wanted the slider displayed on.

Whilst this is not a major issue for me, I was hoping to programmatically add the CPT ID based on the page which is currently loaded. That way I can just use the shortcode in the Content Template and any new pages created with that Content Template would automatically show the correct slider.

I guess this is the tricky part, trying to pull the correct CPT since the page doesn't know which one to use unless you put in the actual ID like you have done.

I realise that I may have to change the way I do things, I just hoped there might be a way to do it automatically.

Kind regards,
Craig

#446150

Minesh
Supporter

Languages: Inglés (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - as you may know posts, pages, cps etc..etc.. is post for wordpress and if you are on page [wpv-post-id] will return page id, if you are on single post [wpv-post-id] return post id.

But I wonder why you create a page with the same title for the posts you are created.

If you want to display the post content you can create a content template or single layout for that post type.

If you are not still sure how you can work with your site, I suggest you should try to create a test site on discover-wp.com and use our reference sites and play with it.
=> https://toolset.com/faq/how-and-why-to-create-a-test-site-in-discover-wp/
=> http://discover-wp.com/site-templates/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.