Panos Galatis

mostly codes...

How to add a dynamic copyright date in WordPress footer

by

Posted on Friday, May 4th, 2012

What this small tip does is to relieve you of the hassle of having to manually update your copyright notice every year. It searches your db for the year that you first published your first post and uses that year as the starting date. Similarly, the function searches for the year your last post was published and sets it as the end date. It is needless to say that the end date changes dynamically. Okay, let’s see how it’s done.

Continue reading

tag icon , , , , , ,

Beautiful day

by

Posted on Thursday, May 3rd, 2012

What a beautiful day!

May 1st was an idyllic day with temperatures rising to 30 degrees Celsius and quite a few people taking their first swim. I really enjoyed the fact that Spring is finally here.

How to use a different sidebar with single.php in WP

by

Posted on Monday, April 30th, 2012

If you are using a single articles page (single.php) and would like to use a different sidebar on those pages, look no further. The answer is extremely easy and useful in many cases.

First of all, make sure that you are using a single.php page. If you are not then there is no reason to go further.

Okay, let’s assume that you are using a single.php file. Open it up with your favorite code editor and go to the point where it reads:

<?php get_sidebar(); ?>

and replace it with:

<?php if ( is_single()) {
                      get_sidebar(single);
                      } else {
                      get_sidebar();
                      }
 ?>

The above code tells WP that if the page requested is “single.php” then the “sidebar-single.php” should be used. In any other case, the normal sidebar will be used.

Ok, now that you did that create a new “sidebar-single.php” file (without the double quotes of course). You can copy your existing “sidebar.php” file and save it as “sidebar-single.php”.

Now, head over to your stylesheet and style the new sidebar as well.

That’s about it! Enjoy :-)

tag icon , , ,

Site changes

by

Posted on Monday, April 30th, 2012

I would like to apologize to my readers for any “hickups” they may have encountered with the layout of the page. The thing is that while I started with a fixed sidebar and header, I decided to give them a more fluid layout, hence the changes.

So, there is nothing to worry about. All is well :-)

Add infinite scrolling to your WordPress theme

by

Posted on Saturday, April 28th, 2012

This post is a slightly more detailed explanation of this excellent article by Devin over at WP Theming. In all cases, all credits should go to Devin and Devin only.

Step 1: What you will need

Adding infinite scroll to your WP theme is not all that hard. What you will need:

Once you download the script place it in the “js” folder inside your theme’s directory. If you don’t have a “js” folder where you usually place all of your Javascript files, you could create one.

After placing your script file inside the “js” folder copy the Ajax loader gif to your “img” or “images” inside your theme’s directory.

Continue reading

tag icon , , ,