All values are saved as native post_meta (when saved to a post) and although you can use the native WP function get_post_meta(), it is better practice to use the relevant ACF function such as get_field(). Why? Because ACF will format the value depending on the field type and make development quicker and easier!
To retrieve a field value as a variable, use the get_field() function. This is the most versatile function which will always return a value for any type of field.
To display a field, use the the_field() in a similar fashion.
Here’s a basic usage example, and please be sure to view the code example page for more.
This …. ?? How to use it??
* Template Name: Home Page
<div id=”content” role=”main”>
<?php while ( have_posts() ) : the_post(); ?>
<h1><?php the_field(‘custom_title’); ?></h1>
<p><?php the_content(); ?></p>
<?php endwhile; // end of the loop. ?>
</div><!– #content –>
</div><!– #primary –>
<?php get_footer(); ?>
I just want simply display fields + Prepend and Append. Ho to do that ??
Can you please use a non-developper language to explain ??
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users