Support

Account

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. ?>