
Hi everybody,
I have done the example existing in this page:
https://www.advancedcustomfields.com/resources/creating-wp-archive-custom-field-filter/
to create a WP archive with custom field filter. but to list all the custom fields of each post, I added this code to the page index.php:
`<?php if ( have_posts() ) : ?>
<?php
// Start the loop.
while ( have_posts() ) :
the_post();
get_template_part( ‘content’, get_post_format() );
$image = get_field(‘image’); ?>
” alt=”<?php echo $image[‘alt’]; ?>” />
<?php if( get_field(‘bedrooms’) ): ?>
Nombre of bedrooms: <?php the_field(‘bedrooms’); ?>
<?php endif; ?>
Adresse: <?php the_field(‘adresse’); ?>
Description: <?php the_field(‘description’); ?>
<?php endwhile; ?>
<?php twentythirteen_paging_nav(); ?>
<?php else : ?>
<?php get_template_part( ‘content’, ‘none’ ); ?>
<?php endif; ?>
My question: how can I display the details of custom fields (image, bedrooms, adresse, description) without typing this code in the while loop of page index.php?
please, any suggestion will be appreciated.