Hacking WordPress Theme

Sometimes something weird happens – I demand something that isn’t available. With software it’s easy (that’s how I got into computers), you dig in the code and you tweak and hack around until it does what you want.

 Through various resources on the web I figured what needed to be hacked and how. Initial idea was to leave core files untouched and hack the theme only, so any time you upgrade your WordPress installation the feature remained untouched.

The only two places you will need to touch are functions.php and main index file of your template. This is such an easy process that almost any can do it in under 15 minutes.

In your WP admin open the Presentation -> Theme Editor screen and click on functions.php – you should see something like the following screen:
Hacking WordPress - click to enlarge

Open the attached hack file and copy everything from it into functions.php, then click Update File. When done, click on Main Index Template or on index.php – you should see something similar to the following screen:
Hacking WordPress - click to enlarge

Replace the line that says
<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

with the following:
<?php print_post_title() ?>

Now, whenever you feel like let your post title leave your blog and point someplace else, just scroll down in your post writing screen, create or select a custom keynamed url1 or title_url or url_title and put that external URL in value box.

Leave a Reply