Support

Account

Home Forums ACF PRO Return ACF Value in Admin area for shortcode

Solving

Return ACF Value in Admin area for shortcode

  • I’m attempting to develop a shortcode for pulling a selected post’s data (excerpt, title, url, post thumbnail) – while it’s easy enough to create a shortcode for this, what i’m looking to do is let a user select the posts they’d like to inject via ACF (currently via a repeater filled with single page link fields using their advanced feature to get post_id) what i’d like to be able to do is on selection and saving of the page, have a secondary field populate with a shortcode snippet with the given post’s id. User can then copy and paste these shortcodes in their editor per the usual method.

    see attached mockup for an idea of what i’m getting at. Thanks ahead of time for any input.

  • Would it be an idea to create a repeater for each post (to select), with 1 Post selector and 1 empty text field.

    Upon save you hook into acf/save and write a simple function which fills the empty field with the necessary shortcode.

  • @beee – I believe that’s what I was attempting to do. If you go here:
    https://support.advancedcustomfields.com/forums/topic/display-custom-field-value-on-edit-page/

    and follow the thread to the bottom of the page. I didn’t use acf/save but rather acf/render_field and php sessions. There’s a screenshot of the final product. let me know what you think.

  • If you achieved it already, why repost it ?

  • @beee – I posted my own question here – because my previous post was in a response to someone else’s question I wasn’t expecting to get an answer there, however it was followed up on. So this post became redundant.

    However i’m leaving it in place in case anyone has the same question and is looking for a solution.

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

The topic ‘Return ACF Value in Admin area for shortcode’ is closed to new replies.