Ticket #6098 (closed enhancement: fixed)

Opened 4 months ago

Last modified 2 months ago

Expose page template functionality via XML-RPC

Reported by: josephscott Assigned to: anonymous
Priority: normal Milestone: 2.6
Component: XML-RPC Version: 2.5
Severity: normal Keywords: has-patch
Cc: josephscott

Description

One aspect of Pages in WordPress that is not currently exposed is page templates. This was mentioned by Srinivas Vedantam on the wp-xmlrpc list:

http://comox.textdrive.com/pipermail/wp-xmlrpc/2008-February/000168.html

Adding a new page_template field to page methods and providing a new method for listing available page templates seems reasonable. wp.getPageTemplates?

I'll put together a patch, with the goal of getting this in after 2.5 is released.

Attachments

page_template_validation.diff (3.1 kB) - added by ryan on 05/05/08 21:38:57.
xmlrpc.php.diff (5.0 kB) - added by josephscott on 05/06/08 16:46:01.

Change History

05/02/08 14:36:10 changed by josephscott

  • keywords changed from needs-patch to has-patch.

I've created a patch that exposes the page template via the 'wp_page_template' field in wp.getPage and can be set via wp.newPage/editPage. I also included a new method, wp.getPageTemplates, which returns a struct of the available page templates. Here's an example of what it returns:

{
    Archives = "archives.php",
    Default = "default", 
    Links = "links.php", 
    TP1 = "tp1.php"
}

The key in the struct is the template description and the value is the one used by the wp_page_template field. So to use the TP1 template wp_page_template would be set to 'tp1.php'.

If you provide an empty wp_page_template field no changes will happen. You can't delete the setting, only change it to another value.

05/02/08 14:38:02 changed by josephscott

The end of the patch looks off. Seems Subversion got confused when generating the diff. So far I haven't been able to convince it to generate a correct one :-(

05/05/08 21:38:57 changed by ryan

  • attachment page_template_validation.diff added.

05/05/08 21:39:24 changed by ryan

Patch adds page template validation and the option to return WP_Error from wp_insert_post().

05/05/08 23:19:28 changed by ryan

(In [7900]) wp_insert_post() -- Validate page template, check return of insert and update queries, add option to return WP_Error. fixes #6227 see #6098

05/06/08 16:46:01 changed by josephscott

  • attachment xmlrpc.php.diff added.

05/06/08 16:47:18 changed by josephscott

New xmlrpc.php patch that adds support for WP_Error in metaWeblog.editPost.

05/06/08 16:49:43 changed by ryan

  • status changed from new to closed.
  • resolution set to fixed.

(In [7901]) Expose page template functionality via XML-RPC. Props josephscott. fixes #6098

05/12/08 23:43:41 changed by ryan

(In [7920]) wp_insert_post() -- Validate page template, check return of insert and update queries, add option to return WP_Error. fixes #6227 see #6098. for 2.5

05/13/08 21:03:11 changed by ryan

(In [7925]) default is a valid page template. see #6098

05/13/08 21:03:46 changed by ryan

(In [7926]) default is a valid page template. see #6098