Site logo

[Resolved] do_shortcode -> image gallery -> attachment page

Home Forums Support [Resolved] do_shortcode -> image gallery -> attachment page

Home Forums Support do_shortcode -> image gallery -> attachment page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2449352
    Ernst Wilhelm

    Hi.

    Building an attachment page I am struggeling with the image itself when I try to use a lightbox for it.

    `$shortcode = “[justified-image-grid ids=” . $post_id . “]”;
    echo do_shortcode( $shortcode );`

    Adding a dynamic shortcode I can’t make it work.

    Can you give it a thought?

    #2449454
    Leo
    Staff
    Customer Support

    Hi there,

    Not sure if I fully understand. This doesn’t sound like a theme related issue though.

    Am I missing something here?

    If it’s more a general WordPress coding question then I’d recommend a forum like this one:
    https://wordpress.stackexchange.com/

    #2450238
    Ernst Wilhelm

    I wanted to execute a shortcode via echo do_shortcode('[justified-image-grid ids="nnnn"]') , combined with a $variable for the ‘nnnn’ part. This didn’t work. A static shortcode like echo do_shortcode('[justified-image-grid ids=featured]') worked for me, but setting the featured image manually. That (version a worked fine, version b didn’t work) was the reason to ask you and not any community like stackexchange.

    Now I found a solution. I could make the image in the attachment page to the featured image of that page (with set_post_thumbnail()). After that I could use a static shortcode [justified-image-grid ids=featured] as mentioned before.

    Thanks for your help

    #2450684
    Leo
    Staff
    Customer Support

    Glad to hear 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘do_shortcode -> image gallery -> attachment page’ is closed to new replies.