Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional tag showing condition before echo 1

Status
Not open for further replies.

followtheboat

Programmer
Nov 29, 2008
53
IN
Hi, newbie here.

I have a condition that displays a call from the database first BEFORE displaying my text, when the code is the other way round. It should say 'You are viewing all excerpts from (date)' when instead it is displaying '(date)You are viewing all excerpts from'.

Any clues?

Code:
<?php 	
	if (is_archive())
{
     echo 'You are viewing all excerpts from' . the_time('F Y');
}

	elseif (is_single()) { echo "blog"; } 
?>
 
you are using wordpress, right?
this is occurring because the_time is an output function rather than a return function. if you look at the code then you will see that it ends with an echo.

so instead

Code:
echo "You are viewing all exceprts from ";
the_time('F Y');
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top