Getting your Google+ Updates Into Your WordPress Blog

1. On Google+ get your user id from the URL (the large number):

2. Go to http://plusfeed.appspot.com/ and add the Google+ user id at the end of it’s URL, e.g. http://plusfeed.appspot.com/111520209329163687335

This will provide you with an instant RSS feed of your public Google+ updates.

3. In your WordPress blog go to Appearance > Widgets > RSS Feed and paste the feed URL.

That’s it :-)

Update: 

Apparently the default frequency with which the RSS widget updates is every 12 hours. If you want to change you can add something like this to your theme’s functions.php:

add_filter( 'wp_feed_cache_transient_lifetime', create_function('$a', 'return 1800;') );

function.reset Passed variable is not an array or object in query.php

I had this problem with WordPress 3.1 where this weird message would come up while trying to access a blog category:

Warning: reset() [function.reset]: Passed variable is not an array or object in wp-includes/query.php on line 2890

I haven’t researched deeply into what is causing the problem but it seems to be related with WPML 2.0.4 and WP 3.1. Essentially is looks like when you update to WP 3.1 you should also upgrade WPML because 2.0.4 is not compatible with 3.1. However when you try to update you’re stuck with having to buy a commercial version of WPML because the authors no longer support a free version, how convenient, right?

I ended up fixing this by following the advice on the forums to create a Page template instead of using the category template and it worked. So basically you need something like this in your template:

query_posts(‘cat=x’);

I can see on Google that a lot of folks are being affected by this as we speak so I decided to share this quick fix.

Thread about this issue on the WordPress.org support forums

Jeditable and admin-ajax.php in WordPress

Jeditable is an awesome in-line editor plugin for jQuery. I was trying to use it with WordPress the other day and I had a little trouble that went like this.

A basic invocation of Jeditable is for example:


$('.edit').editable('http://www.example.com/save.php', {
"callback": function( sValue, y ) {
alert("callback");
},
"submitdata": function ( value, settings ) {
return {
"action": 'edit_item'
};
}
});

The first argument is the URL or function to send the edited content to. The problem when using this with WordPress is that you will end up with a separated file (the save.php) that will be isolated from the WordPress environment. Wouldn’t it be better to run this as a normal WordPress AJAX call?

To use this with WordPress you just need to use as a target the wp-admin/admin-ajax.php and have the action name in the submitdata, e.g.:


$('.edit').editable( '/wp-admin/admin-ajax.php', {
"callback": function( sValue, y ) {
alert("callback");
},
"submitdata": function ( value, settings ) {
return {
"action": 'edit_item'
};
}
} );

Then you can define that AJAX action and access everything on the WordPress side (database, etc).

Skeleton Custom Post Type for Week 4

Last week’s assignment on my P2PU WordPress development course was all about exploring custom post types, that nifty feature that 3.x brought us and that has made everyone talking about using WordPress as a CMS more seriously.

Unfortunately its not so easy to get into custom post types, especially if you’re coming from a non-programmer background. As a way to ease that pain I decided to share a skeleton of the custom post type so instead of starting from scratch you can start from a working version.

As I was planning to do this, @dannygsmith beat me to it and provided the following code. Use it and abuse it, this is your chance to get the assignment done ;)

Custom post type ‘gallery’: download

Also Núria Ramoneda decided to share some links to help you in the process:

http://thinkvitamin.com/code/create-your-first-wordpress-custom-post-type/

http://shibashake.com/wordpress-theme/add-custom-post-type-columns/

http://sixrevisions.com/wordpress/wordpress-custom-post-types-guide/

Thanks to both of them and get to work everyone. Time is running down! But don’t forget.. Enjoy!