onethousandseas
Member
Posted 2 years ago #
Hi, I"m trying to format results on my search results page in a specific way. Right now it looks like this:
<?php
if($post->post_type == 'post') {
echo the_time('Y');
echo the_time('M');
echo the_time('j');
echo the_time('H:i');
}
else {print "Page";}
?>
How can I format it with line breaks to look like this?
<?php
if($post->post_type == 'post') {
echo the_time('Y'); [NEWLINE]
echo the_time('M'); [NEWLINE]
echo the_time('j'); [NEWLINE]
echo the_time('H:i');
}
else {print "Page";}
?>
dollars4click
Member
Posted 2 years ago #
<?php
if($post->post_type == 'post') {
echo the_time('Y')."
";
echo the_time('M')."
";
echo the_time('j')."
";
echo the_time('H:i')."
";
}
else {print "Page";}
?>
http://www.coimbatoreindia.co.in
echo the_time('Y')."<br />"; could do the trick.
Peter
echo
the_time('Y').'<br />'.
the_time('M').'<br />'.
the_time('j').'<br />'.
the_time('H:i');
No need to echo, echo, echo, echo..
Unless of course you're referring to \n aka new line..
onethousandseas
Member
Posted 2 years ago #
Thank you all!
Here's the final code I used:
<?php
if($post->post_type == 'post') {
echo the_time('Y')."<br />";
echo the_time('M')."<br />";
echo the_time('j')."<br />";
echo the_time('H:i')."<br />";
}
else {print "Page";}
?>
Marking it resolved!