python-wordpress-xmlrpc icon indicating copy to clipboard operation
python-wordpress-xmlrpc copied to clipboard

Page template not getting set.

Open rnschmidt opened this issue 11 years ago • 1 comments

I'm using the following code to create a new wordpress page. The page is being created successfully, but the template isn't getting set. I've tried setting new_page.template equal to both the file name of the template as well as the name of the template.

    new_page = WordPressPage()
    new_page.title = state_name + " Market Data"
    new_page.template = "page_marketdata.php"
    new_page.slug = state_name
    new_page.parent_id = '216' #NOTE: Make sure you change this for live site!
    new_page.content = raw_html_page
    new_page.post_status = 'publish'
    wp.call(posts.NewPost(new_page))

Here is the output of pages.GetPagesTemplates:

{'Blog': 'page_blog.php', 'Default': 'default', 'MarketData': 'page_marketdata.php', 'Archive': 'page_archive.php', 'Landing': 'page_landing.php'}

rnschmidt avatar Jul 05 '13 11:07 rnschmidt

I think the proper variable to use is new_page.wp_page_template, but I should add more explicit support and documentation.

maxcutler avatar Feb 12 '14 06:02 maxcutler