How To: Add Social Bookmarking Buttons

  • Posted On: July 28th, 2006
  • Filed Under: Web Design

About a week ago, Arne Brachold wrote an interesting piece on creating links to social bookmark services. If you're looking to add buttons, or text links, which help users submit your posts to these bookmarking services you may want to give it a look.

One thing Arne doesn't mention, though, is how to get WordPress to do this automatically - something that is pretty popular. If you look towards the top of my article pages (pages where comments are available) you'll see an example of how I integrate these services.

Anyway - to get WordPress doing this automatically you really only need to use two of WordPress' Loop tags. One that pulls the pages URL, or permalink, and one that pulls the title. Just remember that these need to be placed inside the WordPress loop somewhere in order to work.

Helpful Loop Tags
<?php the_permalink(); ?>
//This function calls the post's URL
<?php the_title(); ?>
//This function calls the post's Title

If you look at Arne's code you'll simply replace the [URL] and the [TITLE] text with the appropriate functions above. These will form the 'href' value of your link, from there just add either an icon for the service or simply the text - just like any hyperlink.

Oh, one more thing - I recommend encoding the '&' by replacing each occurrence with '&' - this will make sure it validates cleanly.

WordPress Tip: Offsetting Posts

  • Posted On: July 25th, 2006
  • Filed Under: Web Design

When I first started doing my own WordPress themes, and specifically started including AdSense code, I wanted to offset my posts to mix things up a bit. Here on bill2me.com's frontpage you can see an example in the Flickr code included between the two posts on the page. While offsetting posts can provide some interesting options for inserting special elements, entrepreneurial bloggers will also note that the space between posts can be good for placing ads. Of course the problem here is that you can't JUST place the code into the WordPress loop - because it'll force the code to repeat every time the loop iterates. (This can result in too many occurrences of your AdSense code on a single page and be problematic when considering the AdSense TOS.) With a little modification though you can get things working. Read the Rest of this post

Keep AdSense out of your Post Preview

  • Posted On: July 20th, 2006
  • Filed Under: Web Design

A while back I wrote a brief article, AdSense and WordPress 404s, which showed how to keep AdSense off your 404 error pages using WordPress' built in conditional tags.

Another concern which many users might want to address surrounds the issue of AdSense ads being served to your "Write Post" and "Write Page" sections of the WordPress back end. If you look at the pages provided to you for writing posts and pages in WordPress you'll note that a sample of the page is rendered in the "Post Preview" section at the bottom.

What's unfortunate here, is that the "post preview" pulls code right off the 'single.php' template. That means if there is any AdSense code on that template page something that can be misconstrued as a false impression can occur. While the Google AdSense ToS isn't clear on this - I'd rather be safe then sorry. You?

Anyway, here's what we do. For maximum safety we'll build off the code established in the previous post, AdSense and WordPress 404s. Please check out that post if you need more clarification, for now we're working with the following code as a starting base. Read the Rest of this post

Writing One Really Simple WordPress Plugin

  • Posted On: July 13th, 2006
  • Filed Under: Web Design

I played around for a few days trying to figure out WordPress plugins. While in the end it's a pretty easy process, I wanted to do a really basic tutorial for folks who were just getting started. While the WordPress Codex has some links that are great for figuring out some of the more complex tasks, the real basic stuff can be daunting when your getting started with WordPress and especially PHP (basically a requirement of plugins).

To get started I recommend having or getting a basic knowledge of PHP. It's really, REALLY not that hard to come across. I recommend getting started with a book like Sam's Learn PHP in 24 Hours. It's one of the first PHP books I bought and after reading it I was ready to do most of the basic stuff that will be covered in this first tutorial.

This first plugin is going to be very simple. To keep a theme page from getting over cluttered, we're going to add a small plugin just to add a Google Ad quickly. Instead of several lines of code on our index.php file we'll have only one to call the whole Ad. Read the Rest of this post

AdSense and WordPress 404s

  • Posted On: July 4th, 2006
  • Filed Under: Web Design

If you're using AdSense in your sidebar or header (two relatively popular spots in WordPress templates) you need to be aware that Google prohibits the placement of AdSense blocks on Error pages. If you're using a custom 404 page this can pose a problem. The trick here, of course, is that you want to make sure you keep your ads on every other page - but you don't want them appearing on your 404 pages.

Luckily WordPress has a series of "Conditional Tags" that can help you overcome this dilemma. Read the Rest of this post