• So, working with a new theme with a bunch of imported content from a client’s existing website and in their old theme they have multiple images attached to their individual portfolio pages.

    These images all share the same custom field name: project_photo_photo

    The problem I have is, in the new theme, how can I salvage the imported data and utilize the existing custom field name and display the multiple project images for each post within the template of the post loop?

    Below is the code example showing how far I’ve gotten in my attempt to display this content, it only displays one image result, adding multiples of the same block of code only results in displaying a duplicate of the first image:

    <?php if ( get_post_meta( get_the_ID(), 'project_photo_photo' ) ) : ?>
                    <div class="grid_gallery clearfix">
                        <div class="grid_gallery_inner">
                            <figure class="gallery_item featured-thumbnail thumbnail single-gallery-item">
                            	<a href="/wp-content/files_mf/<?php echo get_post_meta( get_the_ID(), 'project_photo_photo', true ); ?>" class="image-wrap" rel="prettyPhoto[gallery]">
                                    <img class="project_photo_photo" width="260" src="/wp-content/files_mf/<?php echo get_post_meta( get_the_ID(), 'project_photo_photo', true ); ?>" alt="<?php the_title(); ?>" />
                                <span class="zoom-icon"></span>
                                </a>
                            </figure>
                        </div>
                        <!--END .slider -->
                    </div>
    			<?php endif; ?>

    I feel I’m close, and there has got to be a way to do this gracefully. If anyone could help me out here I would greatly appreciate it.

  • The topic ‘Displaying Multiple Custom Fields in Post Content’ is closed to new replies.