Building a Custom WordPress for iPhone App

Posted by Jan Vantomme on 29 December 2009.
Tags: , , ,

Some time ago I launched the beta version of the new La Vie En Ville website and I recently finished working on the custom WordPress template. The website was made with HTML5 and CSS3 and uses @font-face for styling the titles. The font used on the website is League Gothic by The League of Moveable Type.

Screenshot of La Vie En Ville

Custom iPhone App

To post pictures to La Vie En Ville I had to build a custom version of WordPress for iPhone. The problem with the original app is that is didn’t allow me to post pictures the way I wanted. The app posts thumbnails with a link wrapped around the image. I wanted to show the pictures without the link and with a size of 640 x 480 pixels.

I started with downloading the source code for the app at Just like WordPress, their iPhone app is open source so this makes it very easy to build the app yourself.

Browsing through the code, I found out that I only had to change some lines of code in the file BlogDataManager.m to make the app work the way I wanted. Let’s take a look at the changes I made.

The first thing I changed is the return statement of the - (NSString *)imageTagForPath:(NSString *)path andURL:(NSString *)urlStr method. The original method has some classes I don’t need and I wanted the width and height to be a fixed value.

Original Code
return [NSString stringWithFormat:`"<img src=\"%`\" alt=\"\" width=\"%d\" height=\"%d\" class=\"alignnone size-full wp-image-364\" />"urlStr, (int)width, (int)height]

Changed Code
return [NSString stringWithFormat:`"<img src=\"%`\" alt=\"\" width=\"640\" height=\"480\" />"urlStr]

Next one is in the - (BOOL)appendImagesToPostDescription:(id)aPost method. This one wraps a link around the <img> tag. I didn’t want the link for the blog so I removed it.

Original Code
desc [desc stringByAppendingString:[NSString stringWithFormat:`"<a href=\"%`\">%`</a>"urlStrimgTag]]

Changed Code
desc [desc stringByAppendingString:[NSString stringWithFormat:`"%`", imgTag]]; 

The last thing I changed is in the same method. This piece of code adds a link and two <br /> tags I didn’t need.

Original Code
desc [desc stringByAppendingString:[NSString stringWithFormat:`"<br /><br /><a href=\"%`\">%`</a>"urlStrimgTag]]

Changed Code
desc [desc stringByAppendingString:[NSString stringWithFormat:`"%`", imgTag]]; 

Custom Interface

I also made some changes to the interface. Here are some screenshots of the icon and the Default.png that shows up when the application launches.

Icon of the Custom La Vie En Ville WordPress for iPhone Application

Custom Default.png for the WordPress for iPhone app.

La Vie En Ville on Twitter

At first I posted the pictures for La Vie En Ville on the @vormplus twitter account. From now on you can also start following @lavieenville on Twitter. This is the place where new pictures will be mentioned.

Tweet this article

Oldskool Comments (1)

Gravatar for Ted

From: Ted
Date: 01.01.2010

This is great! Thank you so much for posting your experience adapting the WP for Iphone app. I was trying to decide today if it would make sense to adapt the app to feature some of the stuff I’ve been doing with my WordPress/BuddyPress stuff (e.g. incorporating activity streams). You’ve totally inspired me.

Top · Permanent link to this comment