php - How do i show value all fields?Wordpress -
i use plugin custom fields.
i created 5 fields , call (cat_content,imagine2,imagine3,imagine4,imagine5
)
all these values stored in vector (fields
)
i browse vector instruction foreach , tried show in list.
unfortunately, list empty ... @ picture below.
http://i59.tinypic.com/2qx58d4.jpg
this site:
<div class="container"> <?php $queried_object = get_queried_object(); $cat_content = get_field('category_content', $queried_object); $imagine2= get_field('imagine2',$queried_object); $imagine3= get_field('imagine3',$queried_object); $imagine4= get_field('imagine4',$queried_object); $imagine5= get_field('imagine5',$queried_object); $fields = array("cat_content","imagine2","imagine3","imagine4","imagine5"); ?> <ul> <?php if (is_array($values) || is_object($values)) {?> <?php foreach($fiedls $value) { ?> <li><?php echo $value; ?></li> <?php } ?> <?php } ?> </ul> </div>
how can solve problem? have done wrong in algorithm code?
thanks in advance!
edit:
i tried make changes not ... @ picture below
http://i58.tinypic.com/1zq3ltx.jpg
this new code:
<div class="container"> <?php $queried_object = get_queried_object(); $cat_content = get_field('category_content', $queried_object); $imagine2= get_field('imagine2',$queried_object); $imagine3= get_field('imagine3',$queried_object); $imagine4= get_field('imagine4',$queried_object); $imagine5= get_field('imagine5',$queried_object); $fields = array("cat_content","imagine2","imagine3","imagine4","imagine5"); ?> <?php echo $fields; ?> <ul> <?php if (is_array($fields) || is_object($fields)) {?> <?php foreach($fiedls $value) { ?> <li><?php echo $value; ?></li> <?php } ?> <?php } ?> </ul> </div>
check
<div class="container"> <?php $queried_object = get_queried_object(); $cat_content = get_field('category_content', $queried_object); $imagine2= get_field('imagine2',$queried_object); $imagine3= get_field('imagine3',$queried_object); $imagine4= get_field('imagine4',$queried_object); $imagine5= get_field('imagine5',$queried_object); $fields = array($cat_content,$imagine2,$imagine3,$imagine4,$imagine5); ?> <?php // echo $fields; ?> <ul> <?php if (is_array($fields) || is_object($fields)) {?> <?php foreach( $fields $value) { ?> <li><?php echo $value; ?></li> <?php } ?> <?php } ?> </ul> </div>
Comments
Post a Comment