WordPress.org

Ready to get started?Download WordPress

Forums

wordpress the_date() function (3 posts)

  1. blazingtopics
    Member
    Posted 4 years ago #

    I'm try to distinguish if the post is 7 days old. If it's older than seven days, then display data1. If the post is not older than 7 days, then display data2. So far I have this:

    if (is_single() && ((int)the_date('d') != (int)date('j') ))
    	{
    		return $data2 ;
    	} else
    		{
    	    	return $data1 ;
    		}
    	}

    Right now when I use this code the actual date gets printed on the post. Since today is the 19th, the number 19 is displayed. I'm not ever sure why it's displaying the date on the page. Any ideas where I can go with this?

  2. blazingtopics
    Member
    Posted 4 years ago #

    ok I manage to work it out a bit. Now my problem is, again, with the_date() function. Is there anyway to use the_date() in a conditional statement without echoing the date?

  3. Alexandar Tzanov
    Member
    Posted 3 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic