Custom Fields displaying in single line

I have custom fields to display in a post. But all of the custom fields are displaying in a single continuous line, while i want them in separate lines. I am not a coder. I tried br, li but still no luck. I also searched in stack exchange and web for similar problem, but could not get answer. Please help.

Below is the Code i have in single.php after - while ( have_posts() ) : the_post(); $key_name = get_post_custom_values ($key = 'country'); echo 'Country : ', $key_name[0]; $key_name = get_post_custom_values ($key = 'status'); echo 'Status : ', $key_name[0];

The result in the post is as below:

Country : Saudi ArabiaStatus : Announced

I want it to appear it like the one below:

Country : Saudi Arabia

Status : Announced

Topic line-breaks custom-field Wordpress

Category Web


I found a solution based on the answer provided by user4379653 here https://stackoverflow.com/questions/27636676/php-line-break-not-working

I used <br /> in echo from the second custom field, as the first field would not require.

$key_name = get_post_custom_values ($key = 'status'); echo '<br />Status : ', $key_name[0];

Thanks to Ivo for trying to help.


Probably not the best solution, but why don't you try the following:

while ( have_posts() ) : the_post(); ?>
<div><?php $key_name = get_post_custom_values ($key = 'country'); echo 'Country : ', $key_name[0]; ?> </div>
<div><?php $key_name = get_post_custom_values ($key = 'status'); echo 'Status : ', $key_name[0]; ?> </div>

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.