3 Useful WordPress Tips

With the new release of WordPress I thought it would be timely to show some examples of useful WordPress snippets to help you in your quest to build brilliant blogs/cms websites. Though these examples are relatively simple they’re all equally essential to help you in building a great site. Below are the examples which you can go and use immediately in your very own site.

Template Files

Sometimes you will want to customise your theme quite heavily and add additional blocks of content into certain pages on your site for example: Home or About Us. To make things easy for yourself you can create a Template name which can be selected within the admin panel of the page under Attributes > Template. To do this you would create your own file named whateveryoulike.php and put the following php before the code you wish to use as the template.

<?php
/**
* Template Name: My Template
*
*
* The "Template Name:" bit above allows this to be selectable
* from a dropdown menu in the page admin.
*
*/
?>

Now, select the template in the page admin area and you will see your page using the template you have created.

Linking To Images

When creating your own theme the easiest way to display images in your theme that haven’t been set within the CSS is to use this useful code snippet.

<img src="<?php echo bloginfo( 'template_directory' ) . ( '/images/myimage.gif' ); ?>" alt="My Image" />

This will search your themes images folder and pull out the image directly.

Including Files

You may be familiar with php includes but within WordPress it is better to call the include in a certain way.

<?php include( TEMPLATEPATH . '/header2.php' ); ?>

This little snippet has help me greatly and I think you may equally find it useful when developing more complex themes.

Related posts:

  1. Really Useful WordPress Plugins
  2. Tips For Launching A Website
  3. How To Speed Up Your WordPress Blogs
  4. WordPress 3.0 Features
  5. Quick Tip 12 – WP Gravatar

Tags: , , ,

Leave a Reply


Contact Us Today...

If you have any questions about our services or want to arrange a free no obligation consultation contact us today or call 02920 290 080 for Cardiff and 01179 000 482 for Bristol.

Bit Torrent Study Discovers Most File Sharers Are Now Monitored

Ever heard of torrents or used Bit Torrent to download movies, music or shared files over the internet? Researchers have discovered that anyone who does use Bit Torrent to download files over the World Wide Web will most probably be monitored. Studies were carried out by Birmingham University and they have discovered that if someone [...]
» more

Cardiff: 02920 290 080 Bristol: 01179 000 482