Tim Yang’s Weblog

Jump to content

About Tim Yang’s Weblog

Nothing to see here.

Categories

Archives

Tags


-->

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

Aug 2005
07

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>


6 Comments

  1. # China Blogs on August 7th, 2005

    Hey Tim,

    Looks like a nice piece of code. But being an utter php illiterate. If you say “Place this code anywhere within the loop.” , where is that in the code? I know I should probably read the same book as you do about PHP but haven’t found the time yet.

    The description code in and the hopefully soon to follow meta keywords code seem promising as well as I was looking for some myself.

    All in all it seems like a good thing you are using wordpress.

    G.

  2. # Tim on August 8th, 2005

    If you put it somewhere near where your headline or content resides on your template, you are fine. The Loop is a Wordpress term for anything in the template between the lines <?php if (have_posts()) : while ( have_posts()) : the_post(); ?> and <?php endif; ?>.

  3. # Ozh on August 8th, 2005

    Nice job with your re-timyang-ifying the site, I’ve been pleased over the last few days to see your design improve. Any release of your theme planned ? I think it could be a successful 3 columns theme.

  4. # Tim on August 9th, 2005

    Thanks, Ozh! I was thinking of releasing it. The layout is quite heavily reliant on a few plugins (six in all). But I don’t think that’s a problem if I include the plugins in the release.

    But I want to wait a couple weeks. I may change my mind about a few things or get a couple more interface ideas. More importantly, I want to watch the trends of the Adsense clicking so I can optimise their positions. Because nearly every blog has Adsense these days, I think themes should always be released with Adsense in optimised positions.

  5. # Ozh on August 9th, 2005

    Oh, really smart move about Adsense position.

    However, I would advise you to release your theme plugin free : first of all, maybe people already use other plugins to do similar tasks, and they may not want to uninstall them to use yours.

    But more important imho, you probably want to release a theme that *looks* like yours actually, but that gives users a chance to easily customize it (ie not putting a link list here, putting a flickr stream there, etc…). But you probably don’t want to see exact replica of your site all over the web :)

    … Unless of course the Adsense javascript is hard-coded in the theme with your account logging clicks :-}

  6. # Tim on August 9th, 2005

    Good point. I’ll release it plugin-free. The only things that will be missing if it were plugin-free are the word-count, most popular articles list, related articles list and the view count. Before release, I’ll change the colour scheme to something quite different but still very corporate.


Your Comment

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>




Credits

Copywriter Malaysia