Dear experts,
Do you know how can I add custom fields to the post excerpts? I created a custom post type named places and wanted to add two custom fields named first_name and address. I would like to add to the excerpt those two custom fields instead of the usual short paragraph.
The way I am pulling my custom post type is as follows:
<?php
/*
* Template Name: Places to go
*/
// Replace the loop.
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'places_custom_loop' );
genesis();
function places_custom_loop() {
echo '<h1 class="entry-title">' . get_the_title() . '</h1>';
the_content();
//WP Query Start
$per_page = 3;
$places_args = array(
'post_type' => 'places',
'posts_per_page' => $per_page,
'paged' => get_query_var( 'paged' )
);
$places = genesis_custom_loop( $places_args );
}
?>
In the Advance Custom Fields plugin docs says that I have to echo out the custom fields like this : <?php the_field('first_name') ?>; But honestly I have no idea how to use it in the code above.
Could someone please help me?
Thanks,
Janeth
Our community of experts have been thoroughly vetted for their expertise and industry experience.