Skip Navigation

[Closed] Shortcode

This support ticket is created 9 years ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 2 replies, has 3 voices.

Last updated by Caridad 9 years ago.

Assisted by: Adriano.

Author
Posts
#263755

Can you please give me an example (using actual numbers - exactly how I should do it) of how to set a custom image size for a featured image in a view. Sorry i don't understand the instructions in the shortcode reference.

Can you also tell me how to add a caption to a featured image in a view - when i add this - [wpv-post-featured-image data="caption"] the image just vanishes completely

Thanks

#263812

The code below is an example of a custom image size. You should paste it in functions.php of your theme:

add_image_size( 'custom-size', 220, 180 );

Then you could call the shortcode like this: [wpv-post-featured-image size=??custom-size?? raw=??false??]

There are some options you could use, you can find everything here: http://codex.wordpress.org/Function_Reference/add_image_size

About the data argument, it returns that: the caption. If the image does not have a caption, nothing is returned.

You should use the code below to achieve what you want:

[wpv-post-featured-image size="custom-size" attr="caption=teste" raw="false"]
#263819

You can use the size attributes to display one of the predefined image sizes:
https://toolset.com/documentation/views-shortcodes/#wpv-post-featured-image

[wpv-post-featured-image size="medium"]

Predefined image sizes are normally added by theme.
You can change the code in the theme or add your own:
http://codex.wordpress.org/Function_Reference/add_image_size

Or you can try adding more predefined sizes with a plugin like:
https://wordpress.org/plugins/simple-image-sizes/

As for the caption, here you have the documentation on captions:
http://codex.wordpress.org/Caption_Shortcode

This is how you would use it:

[caption width="300" caption="[wpv-post-featured-image data="caption"]"]
[wpv-post-featured-image size="medium"][/caption]

Please let me know if you are satisfied with my reply and any other questions you may have.

Regards,
Caridad

The topic ‘[Closed] Shortcode’ is closed to new replies.