Support

Account

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

Solved

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.

    http://i.imgur.com/iQOsUMQ.png

    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.

    http://i.imgur.com/YJRZA9J.png
    http://i.imgur.com/HOKOCqw.png
    http://i.imgur.com/kjtYIfR.png

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

    http://i.imgur.com/EA0HXoF.png

    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:

    http://www.advancedcustomfields.com/resources/getting-started/code-examples/

    http://www.advancedcustomfields.com/resources/getting-started/displaying-custom-field-values-in-your-theme/

    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

    <?php
    /*
    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>

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