Home Forums Front-end Issues How to display created custom fields on front end?


How to display created custom fields on front end?

  • Hi
    I have been using ACF since last one week. I have installed the plugin on my wordpress site and created custom fields like logo, company, Address, email, website, phone number, facebook, twitter etc in the backend and assigned to a custom page a page template which i have created by duplicating the page.php and changed the name.

    When i create new page all the fields which i have created appearing in that page I have added the logo, company, Address, email, website, phone number, facebook link, twitter link etc in their respective fields.

    Now the problem is when i publish the page and try to view the page none of the fields appearing on frontend.

    Please help me how could i make them enable on frontend.

    do i need to add any code if so please mention me precisely in which files i need to add the code

    Thanks in advance

  • Hi!

    You’re asking for too much.. but to get you started. You need to use the functions get_field and/or the_field to display the ACF fields:

    those links should get you going.

  • Hi Jonathan thank you very much for your response.

    I created custom page template in that i have given below code

    Template Name: My Custom Page
    <?php get_header(); ?>

    <div class=”container”>
    <h1 class=”post-heading”><?php the_title(); ?></h1>
    </div> <!– .container –>

    <div class=”page-wrap container”>
    <div id=”main-content”>
    <div class=”main-content-wrap clearfix”>
    <div id=”content”>

    <div id=”left-area”>

    <?php while ( have_posts() ) : the_post(); ?>

    <article class=”entry-content clearfix”>
    <?php if ( ! $featured_image ) : ?>
    <h1 class=”main-title”><?php the_title(); ?></h1>
    <?php endif; ?>

    <p><?php the_field(‘company’); ?></p>
    <p><?php the_field(‘address’); ?></p>
    <p><?php the_field(’email’); ?></p>
    <p><?php the_field(‘phone’); ?></p>
    <p><?php the_field(‘website’); ?></p>


    </article> <!– .entry –>

    <?php endwhile; ?>

    </div> <!– end #left-area –>
    </div> <!– #content –>

    <?php get_sidebar(); ?>
    </div> <!– .main-content-wrap –>

    </div> <!– #main-content –>

    <?php get_footer(); ?>

    When i created a new page i assigned a “My custom Page” template.
    and i got it.

    Thank you very much

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

The topic ‘How to display created custom fields on front end?’ is closed to new replies.