i'm new early for wordpress and php code.
so, i have post type property with type ( apartment, house, villa, etc ). example, for type apartment any three property. but on select option, be like this :
--Type
-Apartment
-Apartment
-Apartment.
so, i want like this :
--Type
-Apartment(3)
but, i use with count. not work for me.
so, this my code :
$args = array(
'post_type' => 'property',
'posts_per_page' => -1
);
$property = get_posts($args);
and this my code select option.
<select name="type">
<option>Type</option>
<?php foreach( $property as $homes ) {
$type = get_post_meta($homes->ID, 'type', true);
if ( $type == '---') continue;
$new_type = count($type);
echo '<option value="'.$homes->ID.'">'.$new_type.'</option>';
} ?>
</select>
anyone can help me? thanks in advance. regards