Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a site with several thousand posts. They all have just a single attached image of varying size. All posts are displayed in full (no thumbnail view). I'd like to be able to change the way the elements display within the posts to be:

  • date (at the top)
  • image caption
  • the attached image (actual size)
  • post title
  • post text content
  • tags
share|improve this question
1  
I'm slightly confused: you indicate that the posts have only a "single attached image", but you list "post text content" in the list of content to output. The answer very likely will vary, based on whether or not you need to output the post text content. –  Chip Bennett Nov 11 '12 at 18:50

2 Answers 2

I was unable to understand if that refers to the frontend or the backend?

The backend could be managed by rearranging the metaboxes with the specific content, you can even move the publishing box on the right to the big area on the left.

For the frontend, you'll probably need to design an extra page template that lists posts if it is a single page (you mentioned 'thumbnail' already) so that a page lists several posts with whatever you need from some query, identically to index.php.

If you want to restructure the default single post view, then create a template single.php (or edit the existing one, should your theme inherits that) and construct the HTML markup as needed, in the order and number of fields required.

See the Template Hierarchy link for better understanding of the template calling order.

share|improve this answer

Something like (in your single.php)

<?php while (have_posts()): the_post(); ?>
  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    <time class="post-time" datetime="<?php the_time('Y-m-d'); ?>"><?php the_time('F j, Y'); ?></time>
    <?php if (has_post_thumbnail()): ?>
      <?php $thumbnail_image = get_posts(
        array(
          'p' => get_post_thumbnail_id($post->ID),
          'post_type' => 'attachment',
        )
      );
      ?>
        <p class="thumbnail-caption"> <?php echo $thumbnail_image[0]->post_excerpt; ?></p>
      <?php the_post_thumbnail('full'); ?>
    <?php endif; ?>
    <header>
      <h1 class="post-title"><?php the_title(); ?></h1>
    </header>
    <?php the_content(); ?>
    <footer>
      <p class="post-tags"><?php the_tags(); ?></p>
    </footer>
  </article>
<?php endwhile; ?>

I haven't tested the image caption bit: let me know if it doesn't work, or if you don't dig the markup.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.