Support

Account

Home Forums General Issues Hot to build shortcode for returning images in Gallery

Solving

Hot to build shortcode for returning images in Gallery

  • I would like to build a shortcode for returning images in gallery, if this doesn’t exist already (not sure).

    For example my authors will write [myimages number=”1″] to display the first image in the gallery and so on..

    Could anyone help with this please?

    many thanks in advance,
    Andrew

  • Hi,

    I couldn’t find anything on this but it should be quite simple.

    In each post, I am adding all the images in the gallery field.

    Now I would like my authors to be able to insert each image between text using a shortcode like this:

    [mygallery image=”1″]
    [mygallery image=”2″]
    etc…

    Any help would be much appreciated!

  • Creating a custom shortcode is not really an ACF subject, even if you’re using an ACF field to do it, which is why you’re not going to find any information on it on the ACF site or in any of the documentation.

    This WP page has most of the information you’ll need on creating shortcodes https://codex.wordpress.org/Function_Reference/add_shortcode and you can find many tutorials on creating custom sortcodes.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Hot to build shortcode for returning images in Gallery’ is closed to new replies.