Archive for the 'Howto' Category

Howto: A better Del.icio.us bookmark maker for Wordpress

Sunday, August 7th, 2005

I promise this is the last Wordpress related post I’m going to make for a long time. I finished with my template and this is the last thing I made for it. I wanted a way to allow people to add my posts to their Del.icio.us collection. I tried Arne Brachhold’s del.icio.us plugin but it wasn’t what I wanted. For one thing, it only worked on single.php. I wanted the bookmark link to be available on the index.php too. Not everyone will visit the individual post page. I also wanted it to have a pop-up. I quite liked the way the old del.icio.us pop-up bookmarklet worked. So here’s how you make a better del.icio.us bookmark. Place this code anywhere within the loop. It works for pages, templates, index.php and single.php.

<a href=”http://del.icio.us/post?url=<?php the_permalink(); ?>&title=<?php the_title('’, ‘’, true); ?>”>add to del.icio.us</a>

And that’s it. But that’s without the pop-up. If you want the pop-up method, first paste this simple javascript pop-up maker in your head tag.

<script type=\"text/javascript\">
function openpopup(popurl){
var
winpops=window.open(popurl,\"\",
\"width=700,height=250,status,resizable\")
}
</script>

Then use this link in your loop instead of the earlier one I showed you.

<a href=”javascript:openpopup(’http://del.icio.us/post?url=<?php the_permalink(); ?>&title=<?php the_title('’, ‘’, true); ?>’)”>add to del.icio.us</a>

Howto: Skip all the other floors when riding in the elevator

Wednesday, August 3rd, 2005

Somehow I always knew this was possible. I’m sure I did this as a kid. But for some reason, I’d forgotten it until I saw this post again.

If you want to avoid stopping at all the other floors when you’re in the elevator, just press the floor number and the door-close button at the same time. All elevators apparently have this “Express” mode built into them.

via TheDamnBlog.com

Howto: Tell-a-friend script for Wordpress

Monday, August 1st, 2005

I had a tell-a-friend script on my old blog. But Wordpress doesn’t have anything like that, not even in plugin form. So I wrote a quick one. This script is extremely simple. It works but there are no checks, validations or contingencies built into it. So don’t kill me, I’m still on page 28 of PHP for Dummies (”Concantenating is not a Mexican dance”). Caveat emptor, you have been warned.

The script is meant for use with single post pages. It does not have to be in the Loop, so it can be placed in the sidebar of single.php. If you put it on index.php (or any other page), it will simply send the url and page title of the first post you ever made (not good). If I was informing Madame X of this post, the message the script sends out is formated like this (but you can change it where appropriate to suit your taste):

Subject: Have a look at this blog page, Madame X

Message: Hi, Madame X, I found this interesting post on Tim Yang’s Geek Blog called “Howto: Tell-a-friend script for Wordpress” that I thought you would also find interesting. It’s at http://timyang.com/2005/07/howto-tell-a-friend-script-for-wordpress.

Signed, Tim Yang

Here are the instructions.
(more…)

Howto: Customising the description metatag to the title of each post in Wordpress

Sunday, July 31st, 2005

Instead of having a set of standard metatags across all the pages of my blog, I wanted to customise the description metatag of each post to the title of the post and the keywords metatag to the categories of each post. I thought I saw a plugin that did this, but when I looked again, I couldn’t find it. Because I’m reading up on Wordpress Template Tags right now, it made sense for me to try do something different with them. So out comes the PHP for Dummies manual. I succeeded (partially) in my goal. If you check the description metatag of each post, they are all customised while the homepage has the standard blog name and description that’s set in the admin interface. But I failed in the categories as keywords because the category template tags don’t work outside of the Loop.

Here’s the code I used. Just copy the description metatag part and paste it between your head tag to achieve the result.

	<meta name=\"description\" content=\"<?php if ( is_single() ) {
		single_post_title('', true);
	} else {
		bloginfo('name'); echo \" - \"; bloginfo('description');
	}
	?>\" />

Howto: Generating a list of earlier posts in Wordpress

Saturday, July 30th, 2005

I had this feature in my earlier weblog. I had ten posts on the home page and I wanted to show in the sidebar a list of the ten posts that pre-dated the ones on the homepage. You can see the unstyled list on the sidebar right now. I used the get_posts function that comes in Wordpress. Although the_date function is supposed to work only within The Loop, somehow it works here. Here’s the code I used.

<ul id=\"earlierposts\">
<?php
$posts = get_posts('numberposts=10&offset=10&order=ASC');
foreach ($posts as $post) : start_wp();
?>
<?php
echo \"<li><a href=\"\";
the_permalink(); echo \"\">\";
the_title('', '', true);
the_date('j M','</a> <em>','</em></li>');
?>
<?php
endforeach;
?>
</ul>

Howto: Fake a Google Page Rank 10

Wednesday, July 27th, 2005

SEO Black Hat has an interesting article on
how to give any website an outward appearance of PR 10. It does work (SEO Black Hat points out a PR10 demo site), but it’s a superficial PR10 that only website visitors are able to see.

  1. Add a permanent (301) redirect with htaccess or some other means on your website to a PR10 site (eg Google.com).
  2. Wait for a Google update to happen. After that, when your website visitors check the PR of your URL, they will see your website now “has” PR 10.
  3. When you have your “new PR”, add a condition to your permanent redirect that says only Googlebots get redirected while allowing your website visitors into your site. Voila! People can now visit your new PR10 website while Googlebots are still sent away.

As the author of SEO Black Hat also says, Google will not index your site while you are permanently redirecting. So as far as Google is concerned, your PR is the same as before the redirect (and it will probably be lower after the update because it can’t index any of the content on your site). You cannot pass on your “new PR” with outbound links. But your site visitors will get fooled and they won’t know any better (unless they try to Google your site).

Note: This works for Google. But it might also work for Yahoo search and other search engines like AskJeeves too. I’m just not sure if it does, but theoretically it ought to.