I’ve created a plugin for wordpress that can auto post pages on demand
my problem is formatting this pages to a specific template
I need that when the post page is auto inserted in the DB, set the Sidebar position
to disabled in order to have a full width page and hide the page title
… this options appear in the dashboard and I can click on them one by one, but that has to be automatic, not manually.
$my_post = array(
'post_title' => wp_strip_all_tags( $tituloFichaP1 ),
'post_content' => $content,
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array( 8,39 ),
'post_type' => 'page',
'post_parent' => $parentPost,
'page_template' => 'microsite',
'comment_status' => 'open',
);
wp_insert_post( $my_post );
By the way, the page_template attribute ('page_template' => 'microsite')
doesn’t work either. Te post is inserted but the template is set to default.
Thanks in advance!!!
I just go through you code, you have done a simple mistake, in “page_template” that should be a file name (filename.php) of your template not a template name . for ex. if your template microsite’s file name is microsite.php than your code will be.
Hope this will help you.