WYSIWYG editor in your WordPress theme or plugin

Prior to WordPress 3.3 adding WYSIWYG editor to a frontend page meant you had almost reinvent the wheel. In WordPress 3.3 wp_editor was introduced which made developer/designer’s life whole lot easier. Now you can add the same editor used when you type up a post can be added anywhere in your theme or plugin (frontend or backend).

I stumbled across this function by accident when I was checking why the WYSIWYG editor was not working on one of my plugins on WordPress 3.3 . You also can allow users to  upload images if the user has necessary capabilities using the editor wp_editor adds.

Read all about it on the WordPress Codex . Hope someone will find it useful.

Blogging from the iPad

WordPress for iOS is not very handy to blog, specially if it has lot of text but it’s perfect on iPad. This post is made from the iPad and I’m loving it. May be I should start a separate blog for it 😕

Bottom line is WordPress for iOS is a win on the iPad. Since blogging became so much easier, expect more blog posts 😀

How to customize a WordPress plugin and upgrade

Sometimes you want to make minor changes to WordPress plugins that no body except your self would want. Then comes the issue of upgrading to new versions of the plugin. git-svn is the perfect tool for this. It has all the cool features of the distributed SCM git and ability to pull from subversion (and push to it as well). Here is how I do it:

  1. Clone the trunk [code language=’shell’ options=’toolbar: false; gutter: false;’]git svn clone http://svn.wp-plugins.org/web-invoice/trunk/[/code]
  2. Make your changes
  3. Commit changes locally [code language=’shell’ options=’toolbar: false; gutter: false;’]git commit -a[/code]
  4. Pull new changes (e.g. new release). Git is very good at merging, you will not have conflicts unless you edit exact same lines in the local version. Still a manual merge shouldn’t be too complicated [code language=’shell’ options=’toolbar: false; gutter: false;’]git svn rebase[/code]

In the example I have taken the svn trunk of Web Invoice WordPress plugin. Hope you find this information useful next time you hack a WordPress plugin.

How to customize Web Invoice e-mail templates

In the latest release of Web Invoice – Invoicing and Billing for WordPress plugin you can customize the e-mails sent to your clients. You can customize the subject as well as the e-mail content. Please bear in mind that Web Invoice only supports plain text e-mails, but you can do wonders with plain text 🙂 .  This can definitely come in handy if you want to localize your invoices or just does not like what comes as default.

Now to get to the point, the e-mail templates are found in ‘Web Invoice’ -> ‘E-mail templates’.  There are three templates,

  • Invoice e-mail – First e-mail your client receives about the invoice
  • Reminder e-mail – E-mail sent when send reminder(s) is selected
  • Receipt e-mail – Sent when the client makes a payment. You also need to set ‘Send Payment Confirmation’ to yes in Settings

All variables are of the format %variable_name. Bellow you will find the list of variables available in the current version.

  • %call_sign – First name + Last name of the client
  • %business_name – Business name as set in the ‘Settings’
  • %recurring – Recurring or not
  • %amount – Amount, with currency symbol and currency formatted
  • %link – Link to the invoice
  • %business_email – Business e-mail as set in the ‘Settings’
  • %subject – Invoice subject
  • %description – Invoice description

You can definitely use the default templates as a guideline for your templates. IMHO, default templaes are awesome 😉

Don’t go away, there is more. You can write your own plugin to add more variables. e.g. you want to use web invoice along with a booking system. In your plugin add a filter for web_invoice_email_variables and add to the global array (variable) $web_invoices_email_variables.

I want to hear what you think about this feature or Web Invoice in general. Please post your ideas and comments in the Web Invoice community forum. Do not forget to subscribe to my RSS feed to get latest news about WordPress plugins and all things web 🙂

Web Invoice exceeds 1000 downloads

Web Invoice – Invoicing and billing for WordPress plugin has exceeded 1000 downloads. It has 1172 dowloads to date. First release of the plugin was made on March 15, 2009 and now in less than 1 month it has more than 1000 downloads.

Web Invoice is ideal for web developers, SEO consultants, general contractors, or anyone with a WordPress blog and clients to bill. If you come under any of the above, you should give Web Invoice a try.

Download or read more about Web Invoice.

How to migrate from WP-Invoice to Web Invoice?

Web Invoice and WP-Invoice are two WordPress plugins that allow sending invoices and bills. Web Invoice is a fork of WP-Invoice with lot of new features that most people will want. In the current release (1.6.2) they are:

  • Send invoice reminders to customers with a secured link back to the
    web invoice
  • Moneybookers, AlertPay or PayPal available if you don’t have a
    credit card processing account
  • Setup recurring billing using Authorize.net’s ARB (Automatic Recurring Billing) feature or Moneybookers
  • Automatically mark invoices paid via Moneybookers as paid (Requires
    merchant status)
  • Automatically mark invoices paid via AlertPay as paid (Requires
    business status)
  • Split gateway support (Your client is given the option of choosing the preferred gateway from the list of gateways you support). e.g PayPal and Moneybookers
  • All user interfaces are internationalized

If you are already using WP-Invoice and would like to leverage these new features, it’s simple. Follow the 3 step process to switch from WP-Invoice to Web Invoice.

  1. Rename the tables invoice_log to web_invoice_log, invoice_main to web_invoice_main, invoice_meta to web_invoice_meta. (Assuming $table_prefix is empty)
  2. Download Web Invoice WordPress plugin and upload it to your server
  3. Activate Web Invoice

That’s all, you can use Web Invoice without losing that you generated with WP-Invoice.

SyntaxHighlighter2 WordPress plugin released

SyntaxHighlighter2 WordPress plugin was released yesterday on WordPress Extend plugin repository. SyntaxHighlighter2 allows you to easily post syntax highlighted code all without loosing it’s formatting or making an manual changes. Main addition is upgrade to SyntaxHighlighter JavaScript 2.0 by Alex Gorbatchev. Also in this release the web master/blogger is given the ability to choose from 6 themes for the SyntaxHighlighter.

If you already using SyntaxHighlighter WordPress plugin and using XHTML, you should upgrade to SyntaxHighlighter2 because SyntaxHighlighter uses invalid XHTML. Bellow you will find the sample WordPress configuration file with SyntaxHighlighter2 🙂 .

[sourcecode language=’php’ ]
[/sourcecode]

WordPress object cache with memcached backend for vanilla WordPress

WordPress object cache with memcached backend is mainly meant for WPMU and doesn’t work well if you happened to have many vanilla WordPress installations using the same memcached backend like it is pointed out here and here.

I have created a simple patch which you can apply against object-cache.php (downloadable from WordPress plugin repository) or here is the file already patched. The patch prepends the $blog_id to the object key. You will have to specify global variable $blog_id in wp-config.php and give it a unique id (like your blog url).
[sourcecode language=’php’]global $blog_id;
$blog_id = ‘mohanjith_net’;[/sourcecode]

Google Analytics for WordPress plugin is incompatible with AddThis plugin

Google Analytics for WordPress plugin adds an onclick attribute to links when “Track outbound clicks & downloads” is enabled irrespective of whether there is already an onclick attribute. AddThis plugin adds a link with onclick attribute to the post when enabled. This combination causes WordPress to generate invalid mark up. Same would happen if the post contains any links with onclick attribute (very unlikely scenario).

I have created a patch (with Git) that adds the content of $coolBit to the existing onclick attribute (without onclick=””) else a new onclick attribute is added with the $coolBit. You can download the patch. I have also reported the issue to Joost (plugin developer).

Hope this will be useful for someone in a similar situation until the fix makes it into the plugin.