Home › Forums › General Issues › How to show post by Field Group name? › Reply To: How to show post by Field Group name?
<?php get_header(); ?>
<div id="content" class="list-post">
<h3><?php echo get_the_title(); ?> </h3>
<?php while ( have_posts() ) : the_post(); ?>
<?php
$acfs = apply_filters('acf/get_field_groups', false);
foreach( $acfs as $acf )
{
// load options
$acf['options'] = apply_filters('acf/field_group/get_options', array(), $acf['id']);
echo '<span>' . $acf['title'] . '</span>';
$fields = get_posts($args);
$fields = get_fields($args);
foreach( $fields as $field_name => $value )
{?>
<?php
//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 "<b>" . $field['title'] . "</b>";
echo "<table width='98%'>
<col width='100'>
<col width='50'>
<col width='100'>
";
// shtese
//echo "<b>" . $acf['title'] . "</b>";
//shtese
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; ?>
<p><?php the_content(); ?></p>
<?php get_the_time( $d, $post ); ?>
<p style="float:right;"> Publikuar në ora <b><?php echo get_the_time('G:i', $post->ID); ?></b> më <b><?php echo get_the_date('j.m.Y'); ?></b></p>
</br>
</div>
<!-- /#content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Can you see code, what it’s displays?
Now, I want to display field by category. But In one category(title=field group name) are displays all fields.
Please help me, this is for my project in university.
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.