Forums

[resolved] How can I embed the gallery in my theme (w/o using [gallery]) (3 posts)

  1. mushon
    Member
    Posted 3 years ago #

    Hi,

    I am using the 2.5+ gallery feature to build a portfolio site. It's working great, but I find myself having to constantly add the [gallery] shortcode to the post. That would've been fine, only since my layout requires the gallery to be decoupled from its description, I find myself having to write my description in a custom field (instead of in the post area where it can also enjoy the benefits of the wysiwyg editor).

    What I am asking is whether there's a way to embed the gallery in the theme itself, and then I can have something like (pseudo code):

    <div id="post-description">the_content()</div>
    <div id="post-gallery">the_gallery('&shortcode_arguments')</div>

    This can be really helpful, but I realize (I have searched for it a lot) that it is not an existing feature yet. Is there another, possibly lower-level way of achieving a similar result?

    +If any of you core developers read this, it seems to me this feature as a template tag would make a lot of sense.

    thanks,

    Mushon

  2. skaufmann
    Member
    Posted 3 years ago #

    Mushon, take a look at this hack I came up with to view the gallery of a post and the content of the same post separately. All I have to to is add the category 'Gallery' to a post that I want to also be added to my Photo Gallery. Links from my photo gallery display the [gallery] automatically without adding it to my post.

    The hack
    http://wordpress.org/support/topic/191230

  3. mushon
    Member
    Posted 3 years ago #

    Perfect!
    Thank you so much! Using
    echo do_shortcode('[gallery option1="value1"]');
    was exactly what I was looking for.

    For further reference this is where it is described:
    http://codex.wordpress.org/Using_the_gallery_shortcode

    WordPress is great, it's only that the documentation's search engine is less than perfect.

Topic Closed

This topic has been closed to new replies.

About this Topic