WordPress’s Pages open the door to using WP as a content management system. Unfortunately, Pages can’t be edited via XML-RPC blogging apps like Ecto. This might be a good thing, but I’m foolhardy enough to try working around it.
Here’s how:
Find a text editor you like and open up the wp-includes/functions-post.php file.
in the wp_get_recent_posts() function, change this:
$sql = “SELECT * FROM $wpdb->posts WHERE post_status IN ('publish', 'draft', 'private') ORDER BY post_date DESC $limit”;
to this:
$sql = “SELECT * FROM $wpdb->posts WHERE post_status IN ('publish', 'draft', 'private', 'static') ORDER BY post_date DESC $limit”;
Now, in the wp_update_post() function, look for this block of code:
// Escape data pulled from DB.
$post = add_magic_quotes($post);
extract($post);
and insert this block underneath it:
// XML-RPCs apps can't return “static” post status,
// so we have to work around it
$page_status = NULL;
if($post_status == “static”)
$page_status = “static”;
And follow that up by looking for this block:
// Now overwrite any changed values being passed in. These are
// already escaped.
extract($postarr);
and insert this block underneath it:
// set post_status static if this is a page
if($page_status)
$post_status = $page_status;
Fair warning: this works in my limited testing, but don’t blame me if you try it and it breaks something. You’d be a fool to mess with this on a live install, so don’t.
tags: blog, blogg as cms, blogg as content management system, blogging, cms, content management system, ecto, hack, hacking, hacking wordpress, php code, wordpress, wordpress hack, wordpress hacks, wordpress pages, xml rpc, xmlrpc
Posted September 22, 2005 by Casey Bisson
Categories: Technology. Tags: blog, blogg as cms, blogg as content management system, blogging, cms, content management system, ecto, hack, hacking, hacking wordpress, php code, wordpress, wordpress hack, wordpress hacks, wordpress pages, xml-rpc, xmlrpc.
24 Comments
Comments RSS
TrackBack Identifier URI
User contributed tags for this post:
wordpress xmlrpc (675) - xmlrpc wordpress (428) - wordpress rpc (321) - xml rpc wordpress (294) - wordpress xml rpc (242) - xml-rpc wordpress (172) - wordpress pages (125) - wordpress XML-RPC (102) - wordpress xmlrpc tutorial (86) - marsedit wordpress pages (80) - rpc wordpress (63) - ecto wordpress (54) - editing wordpress (51) - wordpress xml (50) - wordpress xml-rpc tutorial (49) - ecto wordpress pages (46) - wordpress xmlrpc example (41) - jquery xmlrpc (40) - googleearth com (38) - wordpress ecto (36) - wordpress private (36) - wordpress rpc url (35) - editing wordpress pages (31) - googleearth (30) - status (30) - wordpress xmlrpc post (29) - wordpress post status (27) - wordpress xmlrpc howto (27) - wordpress xml-rpc example (27) - edit wordpress pages (26) - wordpress private pages (25) - Edit Wordpress (25) - XML RPC wordpress com (23) - jQuery rpc (22) - xmlrpc wordpress tutorial (22) - wordpress xmlrpc login (21) - xmlrpc wordpress post (21) - wordpress xml rpc api (19) - php xmlrpc wordpress (18) - wordpress post via xmlrpc (18) - wordpress post xmlrpc (18) - www rpc tv com (18) - how to edit wordpress pages (17) - jquery xml rpc (17) - wordpress xml rpc tutorial (17) - XML in Wordpress (16) - using wordpress xmlrpc (16) - wp_update_post (16) - using xmlrpc wordpress (15) - wordpress rpc post (15) - Using php to post to a WordPress blog via XML RPC (15) - wordpress and xml (15) - wordpress pages edit (14) - wordpress xmlrpc api (14) - wordpress com XML RPC (14) - wordpress xml reader (14) - ecto wordpress api (13) - how to edit wordpress (13) - xmlrpc hack (13) - wordpress xmlrpc examples (13) - xml rpc for wordpress (12) - wordpress wp_insert_post (12) - ecto wordpress com (12) - php in wordpress pages (12) - wordpress xmlrpc error (12) - wordpress com hacks (12) - wordpress xmlrpc hack (12) - wordpress xmlrpc pages (11) - hack wordpress com (11) - wordpress post rpc (11) - xmlrpc wordpress php (11) - wordpress xml rpc php (11) - marsedit wordpress (11) - rpc url wordpress (11) - xmlrpc php wordpress page (11) - post to wordpress via xmlrpc (10) - php post to wordpress XMLRPC (10) - wordpress sql edit (10) - style xmlrpc wordpress (10) - wordpress wp_update_post (10) - wordpress api xmlrpc example script (9) - wordpress, post status static (9) - post to wordpress with xmlrpc (9) - edit wordpress xml (9) - wordpress com xmlrpc (9) - Posting to a Wordpress Blog Via XMLRPC (9) - word blogg CMS (9) - post to wordpress xmlrpc (9) - post wordpress xmlrpc (9) - wordpress rpc xml (9) - wordpress pages xmlrpc (9) - xmlrpc wordpress example (9) - xml-rpc Wordpress tutorial (9) - wordpress xml-rpc post (8) - wordpress xmlrpc how to (8) - wordpress xml editor (8) - xml rpc editing (8) - wordpress posting on pages (8) - wordpress Draft pages Private Pages (8) - wordpress xml rpc post (8) - ecto wordpress page (8) - php xml rpc wordpress (8) - wordpress hack xmlrpc (8) - ecto pages (8) - wordpress page draft (8) - wordpress blog client update pages (8) - wordpress xmlrpc file (8) - F (8) - wp_update_post( ) (8) - wordpress xml format (8) - wordpress 2 5 xmlrpc changes (8) - wordpress xml-rpc howto (8) - wordpress php xmlrpc (8) - wordpress xml rpc example (8) - XML-RPC wordpress php (8) - xmlrpc for wordpress (7) - wordpress xml rpc page (7) - wordpress ecto api (7) - hack xmlrpc (7) - xml rpc wordpress post (7) - XML RPC on wordpress (7) - wordpress post on pages (7) - php wordpress xmlrpc (7) - wordpress xml rpc error (7) - wordpress insert xml in pages (7) - hacking wordpress page (7) - wordpress xml functions (7) - xmlrpc wordpress howto (7) - wordpress api howto (7) - modify wordpress pages (7) - wordpress xml-rpc url (7) - xml-rpc wordpress post (7) - jquery xml-rpc (7) - wordpress xmlrpc tags (6) - hacking wordpress (6) - xmlrpc wordpress hack (6) - how to block googleearth (6) - editing wordpress template (6) - XML RPC wordpress php (6) - wordpress rpc pages (6) - google earth log n status (6) - wordpress how to post via xmlrpc using php (6) - hacking wordpress com (6) - word press ecto (6) - XMLRPC post to Wordpress (6) - xml in wordpress pages (6) - xml rpc post wordpress (6) - wordpress static publish post status (6) -
So it seems this works fairly well. Except now my pages never finish loading. The page looks complete and according to my browser’s activity window, everything is loaded except the page itself. For instance it reads “13.5KB out of ?”. Any ideas?
[...] Editing WordPress “Pages†Via XML-RPC « MaisonBisson.com: WordPress’s Pages open the door to using WP as a content management system. Unfortunately, Pages can’t be edited via XML-RPC blogging apps like Ecto. This might be a good thing, but I’m foolhardy enough to try working around it. [...]
Anyone try this with WP2? I’m interested in trying it but that’s an awful lot of mucking around in core files so I’d rather someone else be the guinea pig.
Alrighty. No go with my install of WP2 and Marsedit. I’d try ecto but I think I used up my trial last year (never got around to actually do a blog)… But it was an XML-RPC error that Marsedit threw, so I’m reasonably sure it’s not unique to the program.
It works a little with ecto and WP 2.0.1. I have to create a blank page in the admin panel, then I can edit it with ecto. This, at least, allows me to update pages quickly once they’re made. However, I have noticed that on some servers, my pages will hang the server’s php for a while if I edit a page too many times. Don’t know what’s up with that.
Is it possible to post a working file with the version numers of WordPress and Ecto.
[tags]Ecto, WordPress Pages,[/tags]
Is it possible to post a working file with the version numers of WordPress and Ecto.
[tags]Ecto, WordPress Pages[/tags]
[...] Quick and dirty code hacking howto on the great MaisonBisson blog (now added to my regular reading list) [...]
[...] this is also deliciously interesting – the use of an external client for blogging? man, i dont even want to start thinking about that. [...]
Hey, I just got this working with WP 2.0.4 and BlogsInHand. I had trouble figuring out where to put the last block, as the original text is not there AFAICS. I put it in the wp_update_post() function after the block starting:
// Drafts shouldn’t be assigned a date unless explicitly done so by the user
as well as in the wp_insert_post function (first function) after the line:
extract($postarr);
and one of these options worked. I also edited the first block to read as follows:
$sql = “SELECT * FROM $wpdb->posts WHERE post_status IN (‘publish’, ‘draft’, ‘private’, ’static’) ORDER BY post_status DESC, post_date DESC $limit”;
This puts the *pages* at the top of the list in BlogsInHand, so they are always available for editing.
I really didn’t know what I was doing, and am surprised this worked so well, but so far so good. Thanks for your great script! This perfected my pocket pc blogging experience.
[...] final coup was finding a lead on the MaisonBisson blog that would allow contributors to use existing applications like ecto, MarsEdit, or Contribute [...]
There’s a pretty easy workaround with Ecto. Just make a post as normal, upload any pictures from the pic editing sheet, and then copy the html.
You can then just paste it into a page.
It’s quick enough, and you get all the custom html templates you may be using.
I understand direct posting is easier, but for the amount of pages I actually creat or edit it’s quicker for me to do ti this way than to remember to re-hack all my php files with each Wordpress update.
Hope this helps!
[tags]wordpress hacks ecto[/tags]
Sadly, this appears to now be broken with the latest version(s) of WP (2.0.6) and/or Ecto (2.4.2). When I try to refresh the posts in Ecto, I get an error in the Console log complaining about the first block change (‘$sql = “SELECT…’).
If anyone is able to find a workaround for this bugaboo, I’m definitely interested.
[...] version includes widgets (by default), some XML-RPC hooks to edit pages (so you don’t need my hacks), a switch to jQuery from Scriptaculous (Matty got me excited about this), full Atom support [...]
It is what I was looking for. Thank you for the post
How to upload XML blog to WordPress. Where can I find the XML Format?
[...] There are two solutions out there. One is to modify the core WordPress files, specifically wp-includes/functions-post.php. [...]
Desktop-Editing mit Wordpress…
Viele werden auf die gleichen Probleme gestoßen sein wie ich, als sie versucht haben Wordpress mittels eines Desktop-Blogging Programmes, wie z.B. ecto zu administrieren.
Denn die API (Application Programming Interface) von Wordpress lässt es ohne kl…..
[...] This post from Maison Bisson described the process of editing the files for a previous version. The good news is, for the latest Wordpress releases (I’ve checked 2.7.0 and 2.7.1), the data model has been changed to remove the “static” post status for pages (They now have the same status codes as posts), which means that no changes are required to the update fundtion; and a field called post_type now stores information about the kind of post (blog post, page, attachment). [...]
Thanks dude that really helped me even if it’s not final in my eyes. I will try to advance your script to fit my needs but thanks for this “base”
.
Trying to figure out how to enable static post editing in the TextMate blogging plugin, but I’m not sure how recent Wordpress updates have changed things. Also, as of ecto v3 you can edit wordpress pages without any mucking around, you just have to request them (ecto doesn’t automatically grab them).
@Alex Yule: Thanks for the update. This post is from 2005, and I haven’t really followed up on it much since then (I’m pretty happy using the web-based editor now). Good luck with your quest.
Does anyone know if there is another language or set of commands beside SQL for talking with databases?
I’m working on a project and am doing some research thanks
Check out a professional script here: http://blog.5ubliminal.com/tags/wpapi/
Cheers.