要通过Wordpress REST api选择模板,通常需要为' template‘键赋值。但是,您似乎不能以相同的方式选择特定的Elementor模板。也就是说,错误只给出"elementor_canvas“和"elementor_header_footer”作为Wordpress旁边的默认选项。
如果我想将Elementor的Full Width Page模板分配给帖子,有没有办法通过Wordpress REST api或通过变通方法以编程方式实现?
def create_page(title):
post = {
'title' : title,
'status' : 'publish',
'template' : 'elementor_canvas'
}
response = requests.post(url + '/pages', headers=header, json=post)发布于 2020-06-19 09:58:34
解决方法包括创建Elementor模板,然后使用sortcode作为帖子的内容。
def create_page(title):
post = {
'title' : title,
'status' : 'publish',
'content' : '[elementor-template id="1159"]'
}https://stackoverflow.com/questions/62461447
复制相似问题