Customizing your WordPress Blog
WordPress has long since been a favourite choice for bloggers world-wide. We love it’s flexibility and expandability through the use of themes and plug-ins, but for those bloggers who want to customize their WordPress blog even further, there is the following WordPress hacks. Blogs with several authors may find these these tips and tricks particularly useful!
Customize your Log-In Screen – Without a Plug-in
If you have many authors / guest bloggers logging in, you may wish to brand your log-in screen. The following code, added to your theme’s functions.php file, will replace the default WordPress logo on the log-in screen with an image of your choosing.
function my_blogs_logo() {
echo '
h1 a { background-image:url(http://www.yourlogo.com/image/location.png) !important; }
';
}
add_action('login_head', 'my_blogs_logo');
Don’t forget to replace the URL with the location of your logo!
Brand Your Admin Screen – Footer Credits
This code, when placed in your functions.php file, will automatically replace the default credits within your admin screen’s footer, with the content you specify.
add_filter( 'admin_footer_text', 'my_admin_footer_text' );
function my_admin_footer_text( $default_text ) {
return '<span>A Blog by <a href="http://www.yourwebsite.co.uk">Your Name</a><span> | Powered by <a href="http://www.wordpress.org">WordPress</a>';
}
Remember to change the credentials above. We would suggest leaving the credit to WordPress in place; after all , it is both free and priceless at the same time!
Create a Teaser Section – Show Upcoming Posts
One of the best ways to keep visitors coming back to your blog is to give them a taste of the awesome content that’s coming soon!. This code will help you create a teaser section populated by scheduled posts. Place this code in your theme’s template files.
<?php
$my_query = new WP_Query('post_status=future&amp;order=DESC&amp;showposts=5');
if ($my_query->have_posts()) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<li><?php the_title(); ?></li>
<?php endwhile;
}
?>
This code can be added anywhere in your theme files or you can even create a page template using it. It’s also worth remembering that currently the list will show post titles; but it could also show an excerpt (the_excerpt) to entice your readers even more!
Breathe New Life Into Old Posts – “This time last year…”
Often visitors to your blog only see the freshest content. We ask, whats wrong with your older posts that never see the light of day? A nice feature to show off some of your older posts is a “This time last year…” section. To achieve this, add the following code anywhere you would like these posts to appear:
<?php
$current_day = date('j');
$last_year = date(‘Y’)-1;
query_posts('day='.$current_day.'&amp;year='.$last_year);
if (have_posts()):
while (have_posts()) : the_post();
the_title();
the_excerpt();
endwhile;
endif;
?>
Once again, remember that the appearance can be altered by using the the_excerpt and the_title functions.
Hopefully you will find these tips and tricks useful! If you enjoyed reading this article, please consider sharing it!