Setting post attributes template with php
-
I send posts to my site via e-mail and use an action on the save_post hook to parse a string from the body of the e-mail to set tags, custom fields and the featured image. That all works fine, but I’d like it also to select a single post template. I have created a new single post php file for the new single template and if I add a new post from the dashboard I can see it in the Post Attributes Template dropdown. But I haven’t figured out how to select it from my save_post hook.
I thought the set_post_type function would do the trick, but not so. Here’s a snippet from my hook code. Here my template name is ‘Trail Post’.
...
set_post_type($post_id, 'Trail Post');
wp_set_post_tags($post_id, 'at', true);
...
- The topic ‘Setting post attributes template with php’ is closed to new replies.