You're browsing the category: Programming

Java, C++, PHP, you name it.

Tutorials

PHP: Automatic Copyright Year

In website footers, we usually use some kind of copyright notice. Something like: “© 2013 NicoleJeanette.me”. In some cases, it may be tedious or we may forget to update this information, especially when updating website designs. The following snippets will help you have a more automatic function of displaying the year.

Add the snippets to the file where you have your copyright notice, it’s usually in footer.php.

If you want to show the current year only:

If you want to show the starting year to the current year:

There’s a function (that validates the information) that you can use to achieve the same information above:

Using the function:

It would display as: © 2013.

It would display as: © 2010 – 2013

Hope these snippets are useful, if you have questions, don’t hesitate to leave a comment or contact me and I’ll get back to you as soon as I can!

Programming / Tutorials

WordPress: Display Author Info

This code is very useful if you have a WordPress website with multiple authors. The code will display a section with your gravatar, name and a little bio (the one you fill out in your user profile). This way, when people read an article written by you, they can see your info.

If you want this to appear on posts, you can add this snippet to single.php:

Feel free to style the classes (author-box, author-pic, author-name and author-bio) as you see fit on your CSS. The ‘100’ you see on the get_avatar function is the width and height of the gravatar. If it’s 100, then it would be 100×100, you can change it to any number.

If you have any questions, please let me know!