Top
Blog Advertising - Get Paid to Blog

Cool WordPress Hacks

May 23, 2008




I love WordPress because it is free and because it gives me all the creative liberty I need. I have come up with a list of a few interesting tweaks to further customize your themes.

Security

Security is an important issu to consider when setting up you blog. Unfortunatly I am no expert in the domain. I do urge you to read the following blog entry by Noupe, if you are concerned about security. You can eaily restrict areas of your server and directories should not be left open for public browsing.

Add an edit button to your theme

You can add an “Edit” button on your individual posts or pages. The code is to be placed in your post and/or page template, usually single.php and page.php). Place the code where you want the “edit” buttton de be:

<?php edit_post_link(__("**Edit**"), ''); ?>

Please note wordpress automatically changes quotation marks. For the code to work you need regular quotation marks, like this, ” .

Adding A drop menu archive

The problem with monthly archives is they tend to get very long. Adding a drop menu is a neet way of reducing the clutter in your sidebar. Here is an example. *Does not work with WP 2.5

<select name=\”archive-dropdown\” onChange=’document.location.href=this.options[this.selectedIndex].value;’>
<option value=\”\”><?php echo attribute_escape(__(’Select Month’)); ?></option>
<?php wp_get_archives(’type=monthly&format=option&show_post_count=1′); ?> </select>

Excluding a category from being displayed

You can use query_posts to exclude specific category being displayed. The following code will exclude all posts in categoryID 4:

<?php query_posts('cat=-4'); ?>

<?php while (have_posts()) : the_post(); ?>
  //the loop here
<?php endwhile;?>
->Note the minus that comes before the category id#

Permalink structure

The most effetive seo permalink structure uses the name of the post not the date or post number. To do this, log in to your admin pannel and click (Wordpress older) “options” and then “permalink” and check the correct option. For Wordpress 2.5 it’s “settings” and then “permalinks”.

Trouble adding videos

Many Wordpress users report diffficulty in adding videos. The page layout becomes messed up. The first thing to try is turn off the WYSIWYG editor and use plain html for building blog entries. If that is not possible for you try using a video insertion plugin like WP-FLV or WP-video.

Adding a theme switcher

If you design themes you may want to add a theme switcher to your sidebar. A theme switcher will add a drop menu with the different themes available for users to choose from. The themes only need to be storred in your wp themes folder.

<?php
if (
(preg_match(”/wordpressuser[^=]*=admin/i”, $_SERVER["HTTP_COOKIE"]))
) { ?>
<div id=”themeswitcher”>
<h3>Theme</h3>
<?php wp_theme_switcher(); ?>
</div>
<?php } ?>

Voila, that’s it for now, stay tuned for more fun things you can do with your themes and templates.

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

Comments

Got something to say?






Comments links could be nofollow free.

Bottom
Entrecard Credit Generator

Copyright © 2008 Pixel Shoppe