Forums

[resolved] Attach (not embed) images to post (7 posts)

  1. Nathan Adams
    Member
    Posted 3 years ago #

    I've been searching for an image plugin for a specific task, to no avail. But I was thinking someone on here might know of a suitable solution.

    I want to be able to attach a few images to a post (say 2-5 large images, and one separate thumbnail). But have these images seperate from the main content - not embedded within in. Such that, I'd have separate tags to implement them within a template.
    (ie. <?php the_content(); ?>, <?php the_images(); ?>, <?php the_thumbnail(); ?>).

    Adding images to the post would involve a custom field type arrangement, where you'd click "add images" button, select or upload the images" and they'd be listed.

    The output of <?php the_images(); ?> might just be a series of <img src="1"/><img src="2"/><img src="3"/> or wrap each image in li tags in an unordered list.

    I figured there might be an image or custom field plugin that would allow something like that, but couldn't find anything. Any help would be appreciated!!

  2. scribu
    Member
    Posted 3 years ago #

    Every image that you upload through WP is first attached to the current post. So you could use get_children() and some other template tags to do what you want without a plugin.

  3. Nathan Adams
    Member
    Posted 3 years ago #

    I'm not quite sure what you mean.

    I want the whole image upload thing to be separate from the main content of the post. So that say, when creating a new post in the admin it's laid out such:
    > Title
    > Content
    > Excerpt
    > Images
    > Thumbnail

    I could add images in the images section, and it will just list the ones I have attached. Not stick them inline in the content wysiwyg editor.
    If the images are not going to sit inline in the flow of the post text, I find this current arrangement can be quite confusing.

    And then in my theme I can have on single pages:

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>"> 
    
    	<div class="content">
    		<?php the_content(); ?>
    	</div>
    	<div class="images">
    		<?php the_images(); ?>
    	</div>
    
    </div>
    <?php endwhile; ?>

    and on the loop have:

    <?php while (have_posts()) : the_post(); ?>
    <div id="post-<?php the_ID(); ?>"> 
    
    	<div class="excerpt">
    		<?php the_excerpt(); ?>
    	</div>
    	<div class="thumbnail">
    		<?php the_thumbnail(); ?>
    	</div>
    
    </div><?php endwhile; ?>
  4. scribu
    Member
    Posted 3 years ago #

    Try using "Pods" plugin or "Flutter" plugin.

  5. Nathan Adams
    Member
    Posted 3 years ago #

    Fantastic, I'll check out both of those.
    Thanks for your help.

  6. cakemuse
    Member
    Posted 2 years ago #

    Did either of these work for you? Pods is not right and FLutter is nice but not what I need.

    Still looking for a contact or attachment plugin to add images...let me know if you have found anything. Unfortunately, I will have to add a post...this is driving me crazy.

    Thanks

  7. Eric Marden
    Member
    Posted 2 years ago #

    You could do this as a custom plugin... add a metabox that includes a drop down list of images (from the media-library, or tied to a folder on disc) and associate them that way. The plugin would just have to save the path or attachment ID in the post_meta, which you can query and pull into your templates.

Topic Closed

This topic has been closed to new replies.

About this Topic