Home › Forums › Front-end Issues › 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/
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
The topic ‘How to display created custom fields on front end?’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.