Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i get publish date in WordPress? [closed]

Tags:

php

wordpress

i want to get post Publish Date like 22 Oct 2014 after the Post title.

i am using the_title(); for the post title But how can i get this date ?

like image 676
Nikunj Soni Avatar asked Oct 22 '14 09:10

Nikunj Soni


People also ask

How do I find the published date of a post in WordPress?

Using the the_date() and get_the_date() Functions The function get_the_date() returns the date for all posts, even if they are published on the same date. However, you need to use echo get_the_date() to output the date.

How do I hide the published date on WordPress?

Open any WordPress posts and find the “Remove Meta and Date” option in the publish box. Uncheck the “Remove Meta and Date” option to unhide the date and metadata. Or check the box to hide them. Using the 'Remove from Homepage' options, users can hide the dates from their Homepage posts.

Can I edit the published date on WordPress?

To change the post date, go to the Posts option in the left toolbar > go to All Posts > hover over the post in question and select edit. Once you are in the post editor, look on the right side of the screen under the Publish section and find the published on date. Next to the date is an edit link. Hope that helps.

How do I get the date and time to show on WordPress?

Showing Current Date, Day, or Time in WordPress You can add this simple code in your WordPress theme's template files where you want to display the time. <? php echo date (get_option( 'date_format' )); ?> This code simply prints the current date using the date format set in your WordPress settings.


1 Answers

Use the_date() or get_the_date() functions. Either directly:

<?php the_date(); ?>

or wrap it with <h2> tag (for example):

<?php get_the_date('F M Y', '<h2>', '</h2>'); ?>
like image 115
Ram Sharma Avatar answered Oct 05 '22 23:10

Ram Sharma