• I don’t know if this is entirely possible – but I am building a single post template for a specific category (I am using the template for individual case studies in my portfolio.)

    But what I am stuck on is I want one full size image that is pulled automatically from the post media gallery into the template layout. I want it to be within the post loop but hard coded into the in the template php (NOT short-coded in the entry content later) . My goal is that I want someone else who is not as comfortable with wp to be able to type in the text in the post box – upload the images to the gallery (but not insert them into the post) and when they select the right category and the images & text will automatically appear how I styled them on that and every category’s single post pages . Is this doable?

    sorry for the long explanation – below is what I have now : it is loading a stretched out thumbnail – so it is the right concept but i want it to catch the first full image in the post image gallery.

    backticks

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    
    <!------- this code below pulls out the thumbnail sized image and stretches it ----->
    <?php $images =& get_children('post_type=attachment&post_mime_type=image&post_parent=' . $post->ID );
    $firstImageSrc = wp_get_attachment_image_src(array_shift(array_keys($images)));
    echo "<img src=\"{$firstImageSrc[0]}\" width=\"500\" height=\"300\" />"; ?>
    
    <!---- the gallery shortcode works and i am using Images Fancified plugin--->
    <?php echo do_shortcode('[gallery]'); ?>
    
    <h2><?php the_title(); ?></h2>
    <div class="entry">
    <?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    
    <div class="features">
    <?php the_meta(); ?>
    </div><!--/features-->
    
    <?php endwhile; else: ?>
    <p>Sorry, no posts matched your criteria.</p>
    <?php endif; ?>

    backticks

Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Can I Pull the first full image out of post gallery inside current post loop’ is closed to new replies.