How to display Date and Time on WordPress

How to display Date and Time on WordPress

Unless you’re a casual Javascript (client-side) or PHP (server-side) user, creating or finding an easy code to show the current date and time on your WordPress website can be a task.

But it’s not; it’s actually very simple to create your own shortcode using PHP and your theme’s functions.php file to display the date and time on any page or post found on your WordPress website.

1. Copy and paste the snippet below into your functions.php file to create [date] shortcode

function displaydate(){
return date('F jS, Y');
}
add_shortcode('date', 'displaydate');

2. Insert [date] where you would like to display the current date and time on any WordPress page or post.

To change the shortcode term “date” replace ‘date’ in the code above (‘SHORTCODE’, ‘displaydate’).

Displaying date and time can be done by using different PHP time constants

j = Day of the month without the leading 0 for single numbers (1 and 31)

d = Day of the month with with leading zeros for single numbers (01 and 31)

S = English ordinal suffix for the day of the month, in 2 characters

F = A full textual representation of a month, (January)

Y = A full numeric representation of a year, in 4 digits (2012)

In the PHP code we created above we use J and s together, such as jS, which is commonly used. It’s also easy to create your own timestamps or date and time signatures using PHP constants. Replace the constants F, jS, and Y in the code below. To find more visit the PHP date manual.

How to fix This webpage has a redirect loop error on WordPress

How to fix This webpage has a redirect loop error on WordPress

A friend of mine recently came upon an issue on her WordPress website. Suddenly she couldn’t visit any of the pages on her website that use the default template for her WordPress theme. Whenever she visited specific webpages on her site the internet browser which she used would fail to retrieve the page. Google Chrome would show a message that says “This webpage has a redirect loop” when attempting to access the webpages.

How To Customize The Font Color Of Text In The WordPress Jetpack Plugin Infinite Scroll Footer (Theme Name, Credits)

How To Customize The Font Color Of Text In The WordPress Jetpack Plugin Infinite Scroll Footer (Theme Name, Credits)

How to change the color of text in Jetpack’s Infinite Scroll footer. By default the Infinite Scroll footer displays text such as the WordPress website’s credits, theme, and title in black. This can be changed in the WordPress Jetpack plugin editor’s css file for the Infinite Scroll option but is much easier and more so suggested to do so using simple custom CSS.

How To Add A Scroll To The Top Of The Page Link On The Jetpack Infinite Scroll Footer (WordPress Jetpack Plugin)

How To Add A Scroll To The Top Of The Page Link On The Jetpack Infinite Scroll Footer (WordPress Jetpack Plugin)

Give your WordPress website visitors the option to scroll back to the top of the page via Infinite Scroll footer link. As stated in a previous article about removing the credits from the Infinite Scroll footer, as of November 10th, we use the new Jetpack 2.0 Infinite Scroll feature and give our website visitors the option to scroll to the top of the page via a simple text link with an arrow (↑) . Here’s how to DIY.

How to remove Infinite Scroll credits on Jetpack

How to remove Infinite Scroll credits on Jetpack

Remove “Proudly powered by WordPress” and your theme name credits in the Infinite Scroll Jetpack Plugin feature. Locate the jetpack/modules/infinite-scroll/infinity.php file and remove footer credits.
Infinite scroll takes away the “next page” or “older posts” links in category and tag page feeds allowing website visitors to infinitely scroll and load new posts via scrolling down the page.

How To Display Related WordPress Posts Without Plugins

How To Display Related WordPress Posts Without Plugins

There are many ways to display recent posts on WordPress without using unnecessary recent posts plugins that are notorious for slowing down WordPress websites. In this article we will discuss how to display related posts on a list per category and tag using simple PHP that can be implemented into theme files such as single.php, category.php, and others.

The Easiest Way To Add Favicons To WordPress Websites

The Easiest Way To Add Favicons To WordPress Websites

Every WordPress website should have a favicon and luckily adding a Favicon to any WordPress website is incredibly easy. There’s no need to install extra plugins that slow your site down, there’s no need to “look in your header” file for a link rel attribute because that will make the favicon theme dependent, leaving it vulnerable to upgrades.