Support » Themes and Templates » How can I embed the gallery in my theme (w/o using [gallery])

  • Resolved mushon



    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.



Viewing 2 replies - 1 through 2 (of 2 total)
  • 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

    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:

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can I embed the gallery in my theme (w/o using [gallery])’ is closed to new replies.