Skip Navigation

[Résolu] attachment thumbnail url

This support ticket is created Il y a 8 années. 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Marqué : ,

This topic contains 1 réponse, has 2 voix.

Last updated by Beda Il y a 8 années.

Assisted by: Beda.

Auteur
Publications
#386186

hej toolset.

i'd like to display a bunch of attachments (fyi: categorized textures and patterns) in a view.
so i am looking for a smart way to receive the attachment urls.

the main part could look like this …

<div class="pattern" style="background:url(my-attachment-url) repeat repeat;">

if found also infos on …
https://developer.wordpress.org/reference/functions/wp_get_attachment_url/

it would be great to have options in what size of the attachment (probably 'thumbnail') the url will lead to.

can you help out with the missing code?

best,
s

#386648
Bildschirmfoto 2016-04-14 um 20.41.09.png

With Toolset Views you can display the Featured Image and any Image or File attached to a Post by a Types Field.

Hoover, we do not have a ShortCode for the attachment URL

Anyway, even if you have crafted your own, I can't suggest to use it as a HTML Attribute or CSS attribute.

ShortCodes API is not allowing this.
https://make.wordpress.org/core/2015/07/23/changes-to-the-shortcode-api/

Views does provide it's own ShortCode parser wpv_do_shortcode() to allow some nested usage of ShortCodes, but still we can not really recommend to use ShortCodes for HTML or CSS.

The function you require, is regarding WordPress API, and we do not provide such Custom Code.

We can though point you to the correct Documentation and illustrate how our own API works, along with the native functionality.
https://toolset.com/toolset-support-policy/#getting-help-with-custom-coding

If you want to return URL of things that you can populate with Toolset such as Fields (image and file) or Featured Image URL, you can do that by outputting a RAW value of them using our ShortCodes for it.

In the ScreenShot I illustrate the situation for featured Images.
This is the DOC for the available Fields and ShortCodes:
https://toolset.com/documentation/customizing-sites-using-php/functions/
https://toolset.com/documentation/views-shortcodes/#wpv-post-featured-image

Thank you

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