Archives

Archive for the ‘wordpress’ Category

Apr 26th

Valid XHTML Facebook like and Twitter tweet buttons for WordPress

2011
16 comments | 7058 views

Summary: Create fully XHTML compliant asynchronous Facebook like and Twitter tweet buttons for your WordPress blog using a pure JavaScript approach and implemented as a simple WordPress template function. Small, clean and lightweight.

Yes, I'm talking about the Facebook like (or recommend) and Twitter tweet buttons. Implementing them on your site is fairly easy - Facebook has a developers page where the anatomy of a like button is documented and you can even use it to generate the HTML code. For twitter, you can find similar information here.

With all that information, it should not be hard to add such buttons to your blog by simply creating the necessary HTML code and fill in the permalink of the article to like or tweet. The result will be a page with working like and tweet buttons but the code will no longer be valid XHTML and all the IFRAMEs may delay the loading process of your page more than necessary. So, there must be a better way, right?

Read more...

23 Likes Like

Apr 17th

Another syntax highlighting plugin for WordPress

2011
No comments | 1477 views

A while ago I blogged about the Syntax Highlighting Evolved plugin for WordPress, a great and invaluable plugin to publish well-formatted and readable code in your blog articles. It is based on the well known JavaScript syntax highlighter by Alex Gorbatchev.

The difference to conventional syntax highlighters is that the formatting runs on the visitor's browser, using modern JavaScript DOM tree modification methods to convert the plain and unformatted code block (usually a <pre> or <code> element) into a formatted and syntax colored display.

The conventional method performs all the processing in PHP on the server and typically uses GeSHi, the most popular and complete syntax colorizer for PHP. GeSHi takes a chunk of code and produces the HTML- and CSS formatted output which can then be embedded into your blog post, wiki article or whatever else you publish. While syntax coloring and -formatting is not really complex, it involves a lot of text matching and "search and replace" operations and can therefore put significant load on your web server, unless you are using one of the more sophisticated caching solutions that allow you to serve static pages to most anonymous visitors.

Offloading this process to the visitor's browser makes therefore sense and can help with the sever load.

Read more...

2 Likes Like
Tags:

Apr 16th

AJAXified comments in WordPress 3

2011
17 comments | 5307 views


I have long been looking for a plugin that would enhance WordPress' comment system with some AJAX features, specifically, it should:

  • a) enable AJAXified comment posting without the need to reload the entire page after a comment had been submitted.
  • b) enable AJAXified comment paging so that people who read larger amounts of comments do not need to reload the complete page.

There have been a number of solutions for both a) and b) but none that combined everything into a single plugin and some of the AJAX commenting plugins are outdated and incompatible with recent releases of WordPress and many modern themes.

Read more...

2 Likes Like

Apr 15th

Updated to WordPress 3.1

2011
No comments | 499 views

WordPress 3 has been out for quite a while now and they've already left the .0 version behind and are now at 3.1. For me, the release of 3.1 was a sign to re-evaluate a possible upgrade.

I've skipped version 3.0, because internal tests on my server have shown a significant drop in performance, especially script execution time. Now, with all the new features, a small drop in performance would be understand- and acceptable, but for me it was in the range of 40-50 milliseconds PHP execution time for every single page view - a bit too heavy for my taste.

3.1 (and possibly all the 3.0.x iterations before) have brought back some performance. It is still a tiny bit slower than 2.9, but it is now in an acceptable range and on the positive side, WP 3.1 puts less stress on the database and only slightly more load on the PHP side than my old version 2.9 did.

So it was time to upgrade my test installation, which is an exact copy of the live site to see if anything would go wrong and find possible problems with the (few) plugins I'm running.

Issues while upgrading from 2.9 to 3.1.1

The upgrade went smooth except one issue that caused my custom permalink structure (/category/pagename) to stop working. After some research I found one of the installed plugins to be the culprit. The multipage-toolkit plugin, which I had installed to allow publishing longer articles split into multiple pages, breaks custom permalink URLs. The fix is easy and is described here. After applying it, everything went back to normal and I found no further side effects. The (slightly) modified version of the multipage toolkit continues to work after the fix.

1 Like Like
Tags:

Sep 23rd

When you are a developer and use WordPress…

2010
1 comment | 2716 views

Every now and then, you stumble over something you did not realize that it exists even though it's so obvious that something like it _must_ exist :)

As a developer, you sometimes need to post source code in your blog. Reading source code can be exciting and rewarding but it can be a pain when the code is not properly formatted. Syntax highlighting is a nice method to improve source code readability and is practically supported by every single development tool that can be used to read or edit code.

It makes sense, because reading highlighted code is a lot easier (and, as a side effect, it also looks better), so naturally, you want this feature to be available when you are frequently posting source code on the web. Read more...

1 Like Like
Tags:

May 6th

How to create a share/bookmark widget

2010
No comments | 3039 views

Share this!

Quick summary: The article explains how to build a bookmarking/sharing widget like the one I'm using on this blog (the Share button, you can see at the bottom of posts). The widget is using HTML, CSS and JavaScript code and can easily be added to any WordPress  template. This is a generic approach, not a plugin targeted at a specific platform though the example code is written with WordPress in mind.

Social bookmarking is everywhere. Whether you like it or not, you cannot ignore it, because users tend to love it when they can easily share a link, video, image or blog article with their friends.

Share this

The entire thing with sharing stuff started years ago with services like Technorati or delicious.com and today we have dozens of social networks that allow their users to share noteworthy things they find on the net.

A sharing widget commonly refers to an element on a web page which allows visitors to submit a piece of content (for example, a blog article, a video or an image) to a number of well-known social sites. The result of sharing a piece of content are different and depend on the site - no need to go into detail here, as most people know how it works anyway. Read more...

3 Likes Like

Apr 13th

WordPress security tips

2010
1 comment | 2694 views

Secure your blog

Using the most popular blogware also means using an attractive target for the bad guys out there. In fact, WordPress does not have the best security records which is, at least partially, a result of its popularity. Developing a successful method to exploit it, opens up a huge number of possibly vulnerable target sites and is therefore much more attractive than exploiting a software used by only a small number of sites. It is pretty much like using a very popular operating system (Windows) or browser (IE, Firefox) - the most popular ones always get the most attention not only by users but also by the bad guys.

That said, no reason for a panic attack. With a few simple rules, you can significantly decrease the chance that someone will break into your blog.

Read more...

1 Like Like
Tags:

Apr 11th

WordPress – the wpautop filter (updated)

2010
No comments | 5478 views

The trouble with wpautop

Sometimes, I want a bit more control over the layout of my posts or pages. While most things can be done with TinyMCE, writing in plain HTML (if you know it well enough) can often be the easier way. However, there is a special feature in WP which can stand in your way. It is called the wpautop filter and its main purpose is to help you with formatting standard articles.

The filter will auto-detect line- and paragraph breaks in your written content and will insert the appropriate HTML code (specifically, the required <p> and </p> tags). That's fine in almost any situation, but it can lead to XHTML validation errors when you write HTML content outside the WYSIWYG editor, in which case, wpautop may insert <p> tags in places where no such tags are allowed to exist (e.g. it may surround <div> tags with <p> and that's not valid XHTML). Read more...

1 Like Like
Tags: ,