Support

Account

Home Forums Backend Issues (wp-admin) Create a plugin for custom field filter

Unread

Create a plugin for custom field filter

  • 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.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.