Blog Web Development Wordpress

WordPress the_excerpt() not working with Chinese Text

WordPress’ excerpt is pretty useful, if the article doesn’t have predefined text as excerpt, it would  automatically create one using the first 55 words from your post to make one for you.
If the original text is:

The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s keeper and the finder of lost children. And I will strike down upon thee with great vengeance and furious anger those who would attempt to poison and destroy my brothers. And you will know my name is the Lord when I lay my vengeance upon thee.

The generated excerpt would become:

The path of the righteous man is beset on all sides by the inequities of the selfish and the tyranny of evil men. Blessed is he, who in the name of charity and good will, shepherds the weak through the valley of darkness, for he is truly his brother’s keeper and the finder of… Read More

It’s great when you’re lazy like me, but what’s not so great is IT DOESN’T work with Chinese text, because it uses the spaces in your sentence to define words, since Chinese text doesn’t use spaces like that, it doesn’t work. The only solution I’ve found is to use the following instead of “the_excerpt();”

 $content = get_the_excerpt();
 $trimmed_content = mb_substr($content, 0, 54)."<a href=". get_permalink() ."> ...Read More</a>";
 echo $trimmed_content;

This works by first retrieving the original excerpt, using the mb_substr PHP function to get the first 55 characters from the excerpt and link it with “…Read More”. If you would like a longer excerpt, simply change 54 (In programming, you start counting from zero) to your desired number.
The main flaw to this function is that if you mix chinese and english articles it won’t be able to tell the difference and end up only giving you the first 55 characters. So that will become

The path of the righteous man is beset on all sides by… Read More

If you have a better way to tackle this, please do share it with the rest of us.
Credits to this Stack Exchange post and yes that is a quote from Pulp Fiction 🙂

Blog Tools & Services Web Development Wordpress

Appointments and Meetings management with WordPress

After my previous post on WordPress Booking Systems I am once again on the look out for a suitable plugin to help me manage appointments and meeting’s for a client.
The WP Booking Calendar plugins I reviewed before was very good at the job but not wanting to settle for what I already know, I went hunting for something more comprehensive. And that’s when I came across WPMU’s Appointments plugin, now it’s NOT FREE. But it is pretty powerful and flexible, aside from the usual ability to allow clients to make bookings and pay, two key function I just love is its ability to sync with Google Calendar and send user email reminders! How cool is that? So in a way it’s more than just a appointment management system but also a personal assistant which I think it’s pretty darn cool.

WPMU Appointmentswpmu-appointment-booking2

Another plugin I looked at is the JS-Appointment Calendar (No longer available) from CodeCanon, again it’s paid at $25 USD at the time of writing, so not the cheapest but it does look like it could be perfect. However, since I already have membership with WPMU, I will test out WPMU’s Appointments first. But good one to check if you are interested.
Let me know if you have any questions on any of these appointments and meetings WordPress plugins. Better yet, if you know of similar tools I should look into, please comment below!
*In case anyone is wondering what that image I used for my featured image is, it’s actually an cropped area of an traditional Chinese daily calendar.

Blog Web Development Wordpress

Reminder for creating custom WordPress sidebars

This is one I keep on forgetting and have to Google on numerous occasions, so I’m adding it to my blog as a reminder.  I like to refer to the Sidebar in WordPress blog by Justin Tadlock, it’s old, written in 2010, but as far as I can see it still work.
There’s 3 parts to creating a custom Sidebar:

  1. Creating the Sidebar PHP file
  2. Registering the Sidebar in functions.php
  3. Adding the sidebar in the page template

1.Creating the Sidebar PHP file

Assuming you want to create a new sidebar called “Special” Duplicate the sidebar.php from your theme and rename it to sidebar-special.php

2.Registering the Sidebar in functions.php

Open the theme’s function.php file and search for my_register_sidebars it should look similar to the following:

add_action( 'widgets_init', 'my_register_sidebars' );
function my_register_sidebars() {
	/* Register the 'primary' sidebar. */
			'id' => 'primary',
			'name' => __( 'Primary' ),
			'description' => __( 'A short description of the sidebar.' ),
			'before_widget' => '<div id="%1$s" class="widget %2$s">',
			'after_widget' => '</div>',
			'before_title' => '<h3 class="widget-title">',
			'after_title' => '</h3>'
	/* Repeat register_sidebar() code for additional sidebars. */

Paste the following lines after /* Repeat register_sidebar() code for additional sidebars. */

		'id' => 'special',
		'name' => __( 'Special' ),
		'description' => __( 'My custom made special sidebar.' ),
		'before_widget' => '<div id="%1$s" class="widget %2$s">',
		'after_widget' => '</div>',
		'before_title' => '<h3 class="widget-title">',
		'after_title' => '</h3>'

3.Adding the sidebar in the page template

In your custom page template, replace get_sidebar(); with get_sidebar('special')
And that should do the trick, But remember to add items in your widgets page.

Blog Tools & Services Web Development

Verite Interactive Timeline

An experiment using Verite Timeline by Impressive interactive result using either JSON or Google Doc Spreadsheet. Can be used as standard HTML embed or via wordpress plugin by Cardume
[timeline font=’Merriweather-NewsCycle’ maptype=’SATELLITE’ src=’’]

Blog Wordpress

WordPress Booking system

UPDATE 25/3/2013: My new article on WordPress Booking Systems 
As a “bonus” function for a project, we needed an very simple online booking/reservation system.
All I needed is a way for potential clients to see which days has already been booked, and be able to make enquiry for days that are still available.
*Disclaimer, I am NOT affiliated with any of the applications or websites mentioned below. 
The following is a list of Plugins I found, tested and deem unsuitable for my purpose.

I then found the following article which I’m very glad to say recommended Booking Calendar.
It provided a very simple way of doing exactly what I needed, and it even has a Premium Version for the extra bells and whistles if you so need them. (Again I am not affiliated in anyway and this is not an advert!)

Blog Wordpress

WordPress and Bootstrap Part2!

I have previously wrote about how much I love Bootstrap and were really looking forward to using it on my next wordpress project. Thanks to this wonderful article from Smash Magazine, I just found out about the Roots Theme which combines HTML5 Boilerplate and Bootstrap from Twitter. Which I have to say is looking very promising
So to sum up. I have the following bootstrap wordpress theme to test:

Blog Tools & Services

New Gems – PM tools and HTML frameworks

It’s been an exciting week for me. Please bear in mind I am rather geeky! Found a number of gems for my work – both in terms of Project Management tool and HTML frames works.

First of all, I had a very clear winner for my hunt for a good project management tool out of the following shortlisted application:

I was on the look out for a user friendly and flexible project management tool. Something that can handle several projects and possibly even my everyday live stuff. The clear winner for me is Trello, it was just so easy to use and had a great way showing lots of information. For me the whole experience is just so much nicer then Teamlab and Podio.
Then out of the blue I got a beta invites from WunderKit, a project management tool by 6WunderKinder, the same folks that created the gorgeous productivity app wunderlist. By the time I knew about wunderlist I was already fairly comfortable with the 2 task management I use everyday Catch and Spring Pad (Service no longer available) and didn’t fancy transferring everything over. So I was very excited to hear about WunderKit. So far my experience it’s good. As expected everything is beautiful, It had a very clean way of structuring projects, keeping everything very clean. I wonder if there would be an Android app for it later on. I just confirmed there is a iOS app but not Android…. which of course makes me very unhappy.

HTML frameworks

As I have previously mentioned, BOOTSTRAP from Twitter ROCKS. I also stumbled across the Foundation Framework, which I’m very excited about working with. But recently I haven’t had any projects that will allow me to make use of it. So that will have to wait.
Luckily i do have a wordpress project coming up and I would 2 Bootstrap based themes:

I will of course keep you all updated on how I get on.