Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,157,582 members, 7,833,889 topics. Date: Monday, 20 May 2024 at 09:12 AM

How To Add DATE FUNCTION To A Wordpress Website - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How To Add DATE FUNCTION To A Wordpress Website (1161 Views)

Php Function To Generate A Random Expression / User Defined Function To Validate Regular Expression In Javascript / Contest[closed] : Program A Function to find if a phrase. is in a string (2) (3) (4)

(1) (Reply) (Go Down)

How To Add DATE FUNCTION To A Wordpress Website by APHATHEOLOGY(m): 11:55am On Mar 28, 2016
A trend of displaying current date which was started with newspapers has been adapted by many blogs.

As more and more users are using WordPress to create magazine style theme, this is just one of the features that can be a great addon to your site. Having a current date looks professional, and it is certainly useful if your articles are dated.

You might think that adding a date to WordPress is hard and will require multiple steps, but it is a short and simple method. In this article, we will share a snippet that will allow you to display today’s date in WordPress or any other PHP based website.

All you need to do is place the following code in a theme file of your choice, most commonly in header.php:

Code: <?phpechodate('l jS F Y'); ?>

The above code will display the date in the following format:

Thursday, 20th September 2014

If you do not like the formatting above, you can look at the PHP Date Manual for other parameters.

Now another way to do this is by just extracting your WordPress admin settings. You can go to Settings > General and select the date format in there and simply add this code instead of the above one

Code: <?phpechodate(get_option('date_format')); ?>

Did you know any other easier method?
Lets learn from you

1 Share

Re: How To Add DATE FUNCTION To A Wordpress Website by talk2hb1(m): 5:41pm On Mar 28, 2016
If . Understand what you are trying to do is display the date a post was published. Thats a wordpress construct built into WordPress.
Re: How To Add DATE FUNCTION To A Wordpress Website by APHATHEOLOGY(m): 5:49pm On Mar 28, 2016
talk2hb1:
If . Understand what you are trying to do is display the date a post was published. Thats a wordpress construct built into WordPress.
Thats not what i mean, with the code above, todays date will be dispayed on your website seperately, apart from the date u post a topic
Re: How To Add DATE FUNCTION To A Wordpress Website by talk2hb1(m): 6:01pm On Mar 28, 2016
APHATHEOLOGY:

Thats not what i mean, with the code above, todays date will be dispayed on your website seperately, apart from the date u post a topic
Okay!!!

(1) (Reply)

Big Data And Hadoop / 12 Year Old Girl Built An App That Can Help Lost Kids Find Their Home / Get Your Front End Website Design Free Of Charge From Now Till August

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.