'From below code i'm getting field names and values... but i need repeater field values as list from all product post type
<?php
// Template Name: Document get_header(); ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="inner-banner text-center">
<div class="container">
<h1><?php the_title(); ?></h1>
</div>
</div>
<div class="main-content">
<div class="container">
<?php
// checking for posts
$query_args = array(
'post_type' => 'product',
'posts_per_page' => '-1',
);
// The Query
$the_query = new WP_Query( $query_args );
// The Loop
if ( $the_query->have_posts() ) {
while ( $the_query->have_posts() ) {
$the_query->the_post();
$fields = get_fields();
if( $fields ) {
echo "<ul>";
foreach( $fields as $name => $value ):
echo "<li>" . $name . " : " . $value . "</li>";
endforeach;
echo "</ul>";
}
}
/* Restore original Post Data */
wp_reset_postdata();
} else
echo "<p>Message Here</p>"
?>
</div>
</div>
<?php endwhile;
endif;
?>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
