WordPress | Date not always appear

I try to create a theme. In that theme I have create a custom post type and I quering the WordPress by using the wp_query to get the posts from that post type with the code that following :

$args = array(
    'post_type'         =>  'portfolio',
    'posts_per_page'    =>  18

$projects = new WP_Query($args);

<h3><?php the_title(); ?></h3>
<span><?php the_date(); ?></span>


the problem is, that while I get the title for all of my posts, I do not get the date for all of my posts. Some posts have the date, other they don't

Any idea for that issue ?


Replace the_date() with the_time() and specify a date format like so:

the_time('l, F j, Y');

Check out the codex article on formatting your date.

Similar questions

How to make Wordpress posts output sorted by the date specified in the post title? And how to display posts with a date in the title > = today's date?
I'm the first time I'm putting out the layout on Wordpress, so I apologize if the question is too simple and obvious: I have a schedule for the upcoming master classes on the page. And I need the posts to be displayed in ascending order of the date (the date is indicated in the post's title, or, if it is more convinient, I can create a custom date ...
Orderby event date (if it exists) or post date (if it doesn't) - how to reorder posts based on meta value OR date
I need a way to sort the posts on my tag and category archives according to the event date (if it exists) OR post date (if it doesn't). I have a combined archive for events and posts, but want to list events based on their event_date meta, instead of the date they were posted. I know I need to update the query to add an "orderby" argument, but can'...
Gravity Forms - Date Picker - Disallow End Date to be before Start Date
basically I have a large form created on my WordPress site using Gravity Forms. One section of my forms has a bunch of items listed with a 'Start Date' followed by an 'End Date' -- Example: Item | Start Date | End Date Item#1 | 05/01/2015 | 05/25/2015 What I am after is making it so I can disallow the 'End Date' from being before the selected 'Star...
Change date format to "d M - d M Y" if start date and end date include two months
I'm using ACF repeater fields to output the dates in my WordPress site. The format I'm getting is "d - d M Y" which is what I need. But I want to change the format to "d M - d M Y" if the start date and end date fall in two months, e.g., 29th March to 5th April. How can I achieve this?
problem with publish date not always appearing
I have this problem where the publish date sometimes appears and sometimes it does not. I am using ACF relationship field to find the story and then bring it to my front page. <?php the_date(); ?> If I open the story and re-publish it with a new publish date it works. http://www.thenewshouse.com
Update post meta date always store 1970-01-07
I want to update the post meta "job_expires" to the current "job_expires" meta data + 1 week but with this code always store 1970-01-07 as date. How can I store the current "job_expires" date + 1 week?

Also ask

We use cookies to deliver the best possible experience on our website. By continuing to use this site, accepting or closing this box, you consent to our use of cookies. To learn more, visit our privacy policy.