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.

* 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. WordPress 3.0 Features
  4. Quick Tip 11 – WP Theme Development
  5. Quicktip 16 – WP Easy Flash Embed

Tags: , , ,

Leave a Reply

Contact Us Today...

For more information regarding any of our services or to arrange a free consultation simply send us a message or call 02920 290 080 for Cardiff and 01179 000 482 for Bristol.

Firefox 4 Beta

Mozilla have released the first beta version of Firefox 4. The latest version of this browser will include better support for many of the new web technologies, a new add on manager, crash protection from third party plugins and accelerated hardware support. One of the most obvious changes is that the tabs have now been moved [...]
» more

Cardiff: 02920 290 080 Bristol: 01179 000 482