Archives

Posts Tagged ‘wordpress’

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: ,

Mar 9th

Permalink structure changed

2006
No comments | 2564 views

On permalinks

Today, I changed the permalink structure for this blog which means that the old links to articles won't work any longer.

Previously, a permalink was made out of the data and the postname and had the format /YYYY/MM/DD/Postname (year/month/day/name of the post). That normally works fine, but I often edit certain posts (like the changelogs) and update the times tamp so that the post will reappear on the top of the blog. This will, of course, also change the permalink for that post (because the date changes) and this will then invalidate links - for example, any external link to that post or links in search engines.

Now, the permalinks have the form /category/postname which means that they will no longer change when I update a post and change its times tamp.

It also makes it easier for you to file bookmarks, because you can now assume that the link to any given article will never change again, even when it is promoted back to the front page by editing its posting timestamp.

1 Like Like
Tags: ,