admin管理员组文章数量:1130349
I found this code to automatically create a page when a new site is created in the network. But I cannot figure out how to set which page template to be used when the page is created. I have a custom page template made which I want to use on the page that is automatically created.
I found this post explaining how to automatically create a page when a new site is made. But what about page template:
I found this code to automatically create a page when a new site is created in the network. But I cannot figure out how to set which page template to be used when the page is created. I have a custom page template made which I want to use on the page that is automatically created.
I found this post explaining how to automatically create a page when a new site is made. But what about page template: https://wordpress.stackexchange/a/28620/143279
Share Improve this question asked Nov 22, 2018 at 12:13 joq3joq3 3813 silver badges21 bronze badges 1- Is the name of the page and its slug always the same? If so you don't need a page template, the template hierarchy lets you use slugs in the filename already – Tom J Nowell ♦ Commented Nov 22, 2018 at 12:35
1 Answer
Reset to default 0After the page is created and you have its ID, and before you restore_current_blog() you do this:
update_post_meta( $page_id, '_wp_page_template', 'your-template-file.php' );
I found this code to automatically create a page when a new site is created in the network. But I cannot figure out how to set which page template to be used when the page is created. I have a custom page template made which I want to use on the page that is automatically created.
I found this post explaining how to automatically create a page when a new site is made. But what about page template:
I found this code to automatically create a page when a new site is created in the network. But I cannot figure out how to set which page template to be used when the page is created. I have a custom page template made which I want to use on the page that is automatically created.
I found this post explaining how to automatically create a page when a new site is made. But what about page template: https://wordpress.stackexchange/a/28620/143279
Share Improve this question asked Nov 22, 2018 at 12:13 joq3joq3 3813 silver badges21 bronze badges 1- Is the name of the page and its slug always the same? If so you don't need a page template, the template hierarchy lets you use slugs in the filename already – Tom J Nowell ♦ Commented Nov 22, 2018 at 12:35
1 Answer
Reset to default 0After the page is created and you have its ID, and before you restore_current_blog() you do this:
update_post_meta( $page_id, '_wp_page_template', 'your-template-file.php' );
本文标签: customizationCreate page when a new site in multisite network is created
版权声明:本文标题:customization - Create page when a new site in multisite network is created? 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749154453a2324375.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论