Home › Forums › General Issues › How to show post by Field Group name? › Reply To: How to show post by Field Group name?
This is code that I use now, but I need to show meta tag by the Field Group name.
Please, help me…
<?php while ( have_posts() ) : the_post(); ?>
<h3><?php echo get_the_title(); ?> </h3>
<?php
$fields = get_fields();
if( $fields )
{
foreach( $fields as $field_name => $value )
{
// get_field_object( $field_name, $post_id, $options )
// - $value has already been loaded for us, no point to load it again in the get_field_object function
$field = get_field_object($field_name, false, array('load_value' => false));
echo "<table width='98%'>
<col width='100'>
<col width='50'>
<col width='100'>
";
if($value != "")
{
echo "<tr>";
echo "<td><b>" . $field['label'] . "</b></td>";
echo "<td align='center'>" . $value . "</td>";
echo "<td align='right'>" . $field['append'] . "</td>";
echo "</tr>";
echo "<hr>";
}
echo "</table>";
}
}
?>
<?php endwhile; // end of the loop. ?>
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.