Instant Automated Publicity of Posts (and Products)!

Gecko Gully Web SitesNow this is cool.  I have been looking for something like this for ages. And it was right there under my nose the whole time.

What this thing can do (among a lot of other things), is notify your Facebook page as soon as a new post is added to your WordPress site.  Or, if you have a WooCommerce site, I will show you how you can make it notify your page when you add a new product.

First, you need to install and activate the plugin called Jetpack (see that  link for even more wonderful things this plugin can do – what I am describing here is just the tip of the iceberg).  This is made by Automattic, the people who make WordPress, so you know it will be compatible.

If you don’t know how to install and activate a plugin, please see this post.  Jetpack is in the WordPress repository (i.e. it is free).

Next, you need to have an account at WordPress.com.  This is also free.  Since it is about 5 years since I set mine up, I am not going to pretend to remember how to do this, but hey a bajillion people have done it, so it can’t be too hard.

Now go back to your own WordPress site admin, and you will find a big thing at the top of the screen saying

jetpack connect to wordpress.com

Click on the Connect to WordPress.com button.

Then you will be asked for authorisation to connect your site to WordPress.com.

Jetpack connect to wordpress.com

Fill in your WordPress.com username and password, and click the blue Authorize button.

After it has been authorised, you should see a nice green page saying “You’re fueled up and ready to go”.  There are lots of toys to play with on this site, but for the purpose of this post, let’s assume you just want to get your publicity set up.

Click on the Settings tab at the top of the page.

Here you will find a number of “Modules”.  Some will have already been activated.  Scroll down a bit to find the one called Publicize, and click on the word Configure that appears on the right when you hover over the word Publicize.

jetpack publicize sharing settings

Let’s assume you want to connect to your Facebook page.  You will need to be logged into Facebook, and already have a page set up.  Or, if you prefer, you can have the plugin post to your own personal Facebook wall.  So, click on the Connect button next to Facebook.

You might see a couple of standard permission-requesting popups from Facebook.  (The first time I did this, they came up, but when doing this for this site they didn’t, so I don’t know what is normal).  Approve whatever it is they are asking.  Eventually you should get a popup that says you have successfully connected your blog with your Facebook account (Yay!).

wordpress jetpack publicize facebook

Click on the dot next to the page you want to send the notifications to, then scroll down to the bottom and click OK.

Now you are all set up to have your posts automatically sent to your Facebook page!

There are a few things you need to know:

  • Saving a post as a Draft will not publicize it.
  • Static pages will not be publicized.
  • Scheduled posts do get publicized – at the time they’re scheduled to publish.
  • Publicize only works for brand new posts that have never been published before. You cannot re-publicize something once it has already been published.
  • If you use a plugin to clone or duplicate existing posts, it will also duplicate its status. If the original post is already published, Publicize won’t be triggered for the cloned post.

This is all taken from http://jetpack.me/support/publicize and there are other things you should read on that page too, so please read it.

Now, next time you write a post, you will see this in the Publish box:

Wordpress publish box

If you have connected the blog to any other sites they will also appear in that Publicize area.

That’s it!  This will now send your post to Facebook as soon as it appears on your blog.

Publishing WooCommerce Products to Facebook

Since a lot of my clients are using WooCommerce, and would love to be able to send their products to their Facebook pages as soon as they are added to their sites, here is what is required for this to happen.

The standard Jetpack plugin doesn’t know Products exist.  It only works for Posts and Pages.  Which for most people is enough.  But for those who use WooCommerce, there needs to be a little further tweak done.

This is a bit “technical”, so if you are my client and want me to do this bit for you, please raise a support ticket and I can do this part for you.  I would do the whole thing for you, only it requires you giving me access to both your WordPress.com account and your Facebook account, which is probably not a good idea.  Anyway, what I have described above isn’t too hard, is it?  😉

Anyway, here is what WooCommerce users need to do…

You need to add the following code to your functions.php file

add_action('init', 'kraft_woo_publicize');
function kraft_woo_publicize() {
  add_post_type_support( 'product', 'publicize' );
}

To get to your functions.php file, hover over Appearance in your admin menu, and then click on Editor.  Note that a lot of sites will have had this ability to edit the appearance files removed as a security precaution, so if this is not available to you get in touch with your web site guy (that’s me if you are my client).

You should see the functions.php file in the right of the page, so click on it.

Now you will see the php program that holds the functions for your theme.  Insert that code above.  Here is an example of how I did it for a site running Headway Themes:

<?php
/**
* Starts Headway
*
* @package Headway
* @author Clay Griffiths
*/

/* Prevent direct access to this file */
if ( !defined(‘WP_CONTENT_DIR’) )
die(‘Please do not access this file directly.’);

/* Make sure PHP 5.2 or newer is installed and WordPress 3.2 or newer is installed. */
require_once get_template_directory() . ‘/library/common/compatibility-checks.php’;

/* Load Headway! */
require_once get_template_directory() . ‘/library/common/functions.php’;
require_once get_template_directory() . ‘/library/common/application.php’;

add_action(‘init’, ‘kraft_woo_publicize’);
function kraft_woo_publicize() {
add_post_type_support( ‘product’, ‘publicize’ );
}

Headway::init();

Note that in this case I put it before the init statement at the end.

Then click on Update File at the bottom of the page.  Now you should see the Publicize information in the Publish box when you go to a product.

If you update your theme, you might need to make this change again, depending on the theme.  So if your Publicize box disappears from your product page, check that functions.php still has that code in it.

One other thing I noticed is that if you have a Short Description on your product it is this, and not the Long Description (the main description box) that gets sent to Facebook.  Ah well.

One thing I didn’t like

I am not sure why not (and I will edit this post if I work it out), but it looks like I can’t go back and publicize a post or product after it has been posted.  As in, I can’t go back and publicize older posts later.

Which leads me to one thing I REALLY like

So, if I schedule posts (or new products) to be released over time, I can get a steady stream of posts appearing on my Facebook page.  I can sit down on the weekend and add several new posts or products to my site to be released over the next week, and the whole posting to Facebook thing just “happens”.

Neat.