WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Large article with large number of photos - how to organize? (3 posts)

  1. skaufmann
    Member
    Posted 6 years ago #

    We post fairly lengthy posts and have from 10-40 photos to go along with the post. I have migrated from the bloated WPG2 to the integrated WP Gallery. The new functionality as of 2.6 gives me most of what I need and I'm tired to WPG2 hackjob integration.

    I have gotten a version of the Ma.tt's gallery category list working. The problem is I've have been uploading all my photos in the article that the written content is in but have been creating a separate post (hidden to frontpage and RSS) when I use the new gallery shortcode ( [gallery id="155"] ) to call the attachments from the corresponding article. The reason I did this is I wanted to keep the association between the article and the photos but I didn't want to display the photos and article in the same page as this would be ridiculously long. My gallery posts have a Gallery category so I can filter the posts out to display my all Photo Albums.

    When I created the template that calls only the gallery articles as a list with highlight photo, since there are no attachments in that article, I'm not able to display the single highlight photo.

    It seems WP is at a point where one more step is needed to distinguish/display photos and article contents. It would be genious if WP had a way (possibly using template hierarchy) to only display the attachments of an article, and likewise only the text of the article.

    Does anyone know a way this can be done now?

  2. skaufmann
    Member
    Posted 6 years ago #

    I've thought through this a little more and I think I've come up with a fairly simple solution.

    In the single.php, it seems the logic could be enhanced so that if URL is the permalink plus ?t=gallery (or anything), the contents of the post would call the [gallery] tag and just display the attachments of the article in a gallery. You could update the loop in index.php, archive.php and whatever else to display the link in the article footer to the attachment filtered permalink of the article if the article has attachments.

    My only problem is my PHP skills suck...

  3. skaufmann
    Member
    Posted 6 years ago #

    Al little bit further-

    I discovered that by using the following in the loop of say the single.php template, it will only display the attachments of that article when the single post is viewed.
    <?php echo do_shortcode('[gallery option1="value1"]'); ?>

    I'm now exploring options on how to access this code in an if statement. I'm trying to play with passing a variables in the URL to tell WP to run this code rather than the "the_content" code.

Topic Closed

This topic has been closed to new replies.

About this Topic