Home Forums Front-end Issues Display custom fields of on page with several posts


Display custom fields of on page with several posts

  • Hello ,

    I Have a page which display several post articles.
    IN the different post articles I would like to display the custom field values but they does not show up .. the posts title and content are displayed but not the acf values.. I don’t understand why.
    Could it be possible that acf does not work with the method query_posts ?


    <?php if (have_posts()) : ?>
        <?php while (have_posts()) : the_post(); ?>
    		<div class="post">
    			<?php the_title(); ?>
    	 <?php endwhile; ?>
    	<?php endif; ?>
    	<?php query_posts('cat=11&post_status=publish,future');?>
    		<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    			<div class="postarticle">
    				<?php the_title(); ?>
    				<img src="<?php the_field('miniature-2');?>" />
    				<p><?php the_content(); ?></p>
    <?php endwhile; else: endif; ?>		
  • Hi @anselme

    Your loop is fine, have you done any debugging?

    Have you tested this:

    echo '<pre>';
    echo '</pre>';

    Are you 100% sure that ‘miniature-2’ is the correct field name? not ‘miniature_2’?

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Display custom fields of on page with several posts’ is closed to new replies.