WordPress Development Magazine
Practical guide to WordPress development, blogging and programming
  • About
  • Advertise
  • Archives
  • Contact

WordPress SMS Notifications

Greg Winiarski February 18, 2012 1 Comment

Despite SMS technology being almost 20 years old (the first official SMS was sent on December 3rd 1992 in the UK), there is still a huge problem with sending messages from applications. This is usually because there is no unified SMS API or there is no API at all, just SMS gateways.

Some time ago I was contacted by Pavel from TextMagic.com, a service that aims to solve this problem. While the TextMagic service is not free, I decided to write a tutorial about it since I believe many developers will find it useful.

This will be a pretty basic tutorial that shows how to send SMS messages to a WordPress administrator when a new post is being published (this might be useful when you have multiple authors on the blog).

Getting an API Key

Before getting started, you need to register your account at TextMagic. You will get 10 free SMS credits, which is quite nice because it allows you to test the service for free. When done, you need to log in and generate your API password. Finally, you need to apply for a SenderID (apply suggests that the Sender ID has to be approved by someone, but it seems it’s auto approved). Now we are ready to write some code.

You will find TextMagic API documentation at api.textmagic.com. PHP SDK is also available, however we won’t be using it since it does not fit our needs exactly, plus we will need just one API function.

Below is the source code with inline comments for a WordPress plugin that will send an SMS message when someone publishes or updates a blog post:

/*
Plugin Name: TM Example
Plugin URI: ditio.net
Description: TextMagic Example
Author: Greg Winiarski
Version: 0.01
Author URI: ditio.net
 
TextMagic SMS delivery example.
 
*/
 
add_filter('wp_insert_post_data', 'tm_insert', 0, 2);
 
function tm_insert($post) {
 
    if($post["post_status"] != "publish" || $post["post_type"] != "post") {
        // run only when post is published
        return $post;
    }
 
    $isUtf = false;
    $title = substr($post["post_title"], 0, 140);
 
    if (preg_match('!\S!u', $title)) {
        $isUtf = true;
    }
 
    $arr = array(
        "cmd" => "send",
        "username" => "your-username",
        "password" => "your-api-password",
        "text" => $title,
        // recipient phone number, starts with country prefix
        // should be just numbers, if you wish to send it to
        // multiple recipients you need to seperate numbers with comma
        "phone" => "48601xxxxxx",
        "unicode" => $isUtf,
        // from is the Sender ID you registered earlier
        "from" => "TM-Example",
        // make sure just one sms is sent
        "max_length" => 1
    );
 
    $query = http_build_query($arr);
    $result = wp_remote_get("www.textmagic.com/app/api?".$query);
    if(is_wp_error($result)) {
        // log error message somewhere
        $object = json_decode($result["body"]);
        $error = $object->error_message;
 
    } else {
        // sms sent
        $object = json_decode($result["body"]);
 
    }
 
    return $post;
}

Please note that TextMagic also offers an Email To SMS service that allows you to send SMS messages without any programming knowledge at all, which is very cool.

The tutorial is now complete; however, feel free to expand on it further by adding functionality that will allow you to check your account balance and SMS logs. Please see API documentation for more details on how to do this.

google facebook twitter
i
General
ñ
WordPress, WordPress Development, WordPress Plugin

WordPress Theme Frameworks 101: What and Why

Ishan December 10, 2011 1 Comment

spacer Let’s talk about all this geeky WordPress stuff later.

First, there’s a breaking news. Scientists have invented digital clothes that can change colors when needed. Imagine buying 2 or 3 comfortable dresses and having them change colors when needed.

That would be great, right?

OK, there’s no such invention. I was just getting the idea into your mind.

Now, replace yourself with your WordPress blog/website and this digital cloth with a theme framework.

Got the idea?

What is a Theme Framework?

If you are interested in WordPress, you must have heard the words “Theme Framework” floating around the internet. Ever wondered what it is?

Well, a theme framework is just like the digital cloth I mentioned above. Here’s what WordPress Codex says about it:

A Theme framework is a Theme designed to be a flexible foundation for quicker WordPress development, usually serving as a robust Parent Theme for Child Themes.

So, the idea is to have a solid foundation for a good design.

This also highlights how a theme and theme framework are different. A theme is a complete package. It comes with a good design and you are ready to go after installation and a few careful changes. When you buy a theme, you are buying a painting. hand it on the wall and you are good to go.

A theme framework, on the other hand is like a blank canvas. You have to paint it yourself or get a good painter.

Why You Should Use A Theme Framework?

One most important reason:

Changing themes is a necessity.

You can stay with same old design for long! In a recent article, Smashing Magazine said that one year is quite a long time for a design these days.

Fine, one year may not suffice but it is fine to change design every two to three years. And that means lot of costs. Apart from visible costs, here are some other things that may affect your blog or website(and which a framework can save you from!):

  1. SEO: SEO is important for any website. This is how search engines find you. With a new design, your site information may change. For example, all H2 tags becoming H3 and other weird stuff. With a theme framework, you do not need to care about this as back end stays same, just design changes.
  2. Loading Times: A significant slow down of website can turn down even the most loyal visitors. If you redesign and then the site gets slow, it would be harmful. With a theme framework, only front end will change which won’t slow down anything. While look and feel will change, speed will remain almost same.
  3. Isolation: When editing themes, the biggest problem is getting an error. And since PHP is an interpreted language, a small error can take down whole blog. With theme framework, all the changes are isolated. You usually edit a single file or a child theme. In worst case, you ‘ll have to disable child theme but your content will still be there! By providing isolation, a framework can make your life easier.

Which Framework to Choose?

I’ll discuss this in next post on Monday. If you have any suggestions, do comment!

Image Credit: kaz k via flickr.

google facebook twitter
i
Must Reads, Plugins, Themes, WordPress
ñ
Plugins, slider, Theme Framework, Themes, WordPress

How To Backup Your WordPress Blog

Ishan December 9, 2011 1 Comment

spacer While WordPress Security is very important, nothing is fully secure.

If someone wants to hack your blog or website, they will do it sooner or later. And security is not the only issue. You have other things too that can cause problems like server faults, SQL database corruption.

The best way to be secure is to take regular backups.

Here are useful WordPress Plugins that can backup your blog for you:

  1. WP Complete Backup: WP Complete Backup saves all the files as well as WordPress Database on your server. The backups are stored on random locations and you can manually download them when and as needed.
  2. WordPress Backup to Dropbox: Everything is going to cloud these days. Why not send your WordPress backup as well? WordPress Backup to Database plugin saves all your files and SQL database to your DropBox account at given time of day. You can select where to store files and if any files have to be excluded.
  3. WP DB Backup: WP DB Backup takes regular backup of your database. It can take scheduled backups and store them on server or mail them to you.
  4. Backup And Move: Backup and Move plugin is useful if you want to move to a different server. It allows to store the WordPress installation on different server, domain or sub-domain easily.
  5. VaultPress: VaultPress is not a plugin but a service. And it’s not free. But for $15 per month, it will take regular backups of your blog. You can also get support in case there’s a problem from experts.

These are some of the best plugins to help safeguard your blog.

Know any other good ones? Do not forget to comment.

google facebook twitter
i
Plugins, WordPress

How To Integrate WordPress With Social Networks

Ishan November 30, 2011 2 Comments

I’ll give you a phone. A smartphone that is special. I’ll give you this phone:

spacer

iPhone 4S

Interested?

Let me make you the deal more special for you.

I’ll integrate your iPhone with all your electronic items in your home. So, you’ll be able to cook food while sitting on your couch playing Angry Birds or Infinity Blade.

OK, now that I’m done with my quota for iPhone reference, let me put this straight.

You’ll love a phone like that can control everything in your home, right?

Now, consider this:

Internet is your home and WordPress is the iPhone. You publish a post and automatically, all your social profiles will be updated about it!

Sounds interesting?

That is exactly what I’m going to teach you in this post, how to integrate your WordPress blog with social networks.

Facebook

I’ll start with the biggest social network, Facebook.

We’ll use Wordbooker for this.

spacer

Wordbooker Plugin For WordPress

Wordbooker allows you to cross post to Facebook. You can post whole post or just an extract.

  • You can post to your profile, group or page.
  • Different users can post to different accounts.
  • The published posts show a WordPress icon instead of normal note icon on Facebook. A small but nice touch!

Twitter

Twitter is next in line.spacer

And for it, we have Twitter Tools.

The description of WordPress plugin page reads:

Twitter Tools is a plugin that creates a complete integration between your WordPress blog and your Twitter account.

And every word is true.

This plugin is impressive!

Here’s what all it can do for you:

  • Publish your posts to Twitter.
  • Publish a daily digest of your tweets.
  • Allow you to tweet from WordPress Dashboard.
  • Display a widget of your latest tweets, which has a nice tweet option below it.

Linked In

spacer Linked In offers a relatively simple service.

Instead of a plugin, you just need to add a simple app on Linked In. And then name of app is….. no prizes for guessing it: WordPress App.

Just add app to your profile and enter your blog address.

Poof…. It’s that simple!

Tumblr

Tumblrizer allows you to cross your posts to Tumblr and Posterous easily.

spacer

You can post to a group, add tags to your posts(same as WordPress) and independently publish to Posterous if you want to skip Tumblr.

These plugins can help you integrate your WordPress blog with famous social media sites. From now on, all you need is to post something on your WordPress blog and all your social profiles will be updated!

Sit back on your couch and enjoy.

Do not forget to comment and subscribe though!

google facebook twitter
i
Must Reads, Plugins, Reviews, WordPress
ñ
facebook, Plugins, slider, Social Network, Social Networks, WordPress

WordPress Developers: Where To Find Work

Ishan November 28, 2011 No Comments
spacer

Image Credit: titanas vis flickr

It’s great time to be a WordPress Developer. You can do design, coding or both and make good money.

If you have good WordPress skills, you can find work for yourself. But where?

That is what this post covers.

Here are some of the best places to find WordPress related work:

  1. oDesk: oDesk is a leading freelance marketplace and you can find lot of WordPress related work there. Currently, WordPress is fifth most requested skill on oDesk.
  2. Elance: This is another good freelance marketplace. WordPress is third most request skill here.
  3. Twitter: Twitter is a good place to look for jobs. Search for “wordpress help” and you will surely find someone in need of help.
  4. Freelance Switch Job Board: Freelance Switch Job Board is a good place. The best thing is that there are mostly quality postings here. But you have to pay $7 per month to apply to jobs. A small trade-off for quality, I’d say.
  5. Smashing Magazine Job Board: Smashing Magazine is a highly respected blog related to web design. If you want to find some WordPress related work, this is a good place.

Any other suggestions?

Do let me know via comments.

google facebook twitter
i
Must Reads, WordPress

Turn WordPress Into Music Blog: 4 Plugins For Playing Audio

Ishan
gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.