Product:
WonderPlugin Slider, WonderPlugin Carousel
Question:
I've created an image slider using custom posts, and I wondered if there was a way to replace the post excerpt with a custom field? I'm using the Advanced Custom Fields plugin, as well as OpenHook if that might be needed. I'm seeing that %post_excerpt% is accepted in the description; is there something similar I can do to include custom fields I've created?
Answer:
In WonderPlugin Slider, the "Add WooCommerce / Custom Posts" dialog, "Field for Title" and "Field for Description", you could enter your own custom fields and display them.
For example, if you have a custom post type "Movie", and you have created three custom fields for the post type:
Field Title: Director
Field Type: text
Field Slug: director
Field Title: Year
Field Type: text
Field Slug: year
Field Title: IMDB URL
Field Type: text
Field Slug: imdb-url
In the "Field for Description", you could enter the custom field slug (make sure it's the field slug, not the field title) wrapped with % %
. For example:
This movie was directed by %director% and released in %year%. Please view <a href="%imdb-url%" target="_blank">IMDB</a> for more information.
In the above code, the custom field slugs %director%
, %year%
, %imdb-url%
will be replaced with the value of the item when the slider is published.