Plugin Author
Ulrich
(@grapplerulrich)
At the moment not, I will be adding this in a future release. I need to rethink a few a things.
Thanks! For the time being, I’ve got a script in my functions.php that’s automatically adding a new page (if one doesn’t exist already) with the same title as the video when the video is saved, and inputs the shortcode into the page and saves the video id as a variable for use in pulling out some custom fields I’ve added. Not ideal, but it’s working for this instance.
Plugin Author
Ulrich
(@grapplerulrich)
Could you share this code? I would be interested.
A friend helped me put it together, so I can’t take credit for it, but here it is. Hasn’t really been tested very adequately, just in my unique instance.
//Generate New Page from Video
function copy_videos_to_pages( $post_id ) {
// Only if we're saving a flowplayer5 video
if ( 'flowplayer5' !== get_post_type( $post_id ) )
return;
// Get $post object for video currently being saved
$video = get_post( $post_id );
$page_title = get_page_by_title( $video->post_title, '', 'page' );
//Prevent Infinite Loop - http://codex.ww.wp.xz.cn/Plugin_API/Action_Reference/save_post#Avoiding_infinite_loops
remove_action( 'save_post', 'copy_videos_to_pages' );
/**
* Check to see if a Page with the same title as this Video exists.
* If not, create a new Page
* Not totally foolproof, but a simple check.
*/
if ( is_null( $page_title ) ) {
//Create new Page that includes content from Video
$my_post = array(
'post_title' => $video->post_title,
'post_date' => $video->post_date,
'post_content' => '[flowplayer id="' . $video->ID . '"]',
'post_type' => 'page',
'post_status' => 'publish',
);
$post_id = wp_insert_post($my_post);
add_post_meta($post_id, 'related_video', $video->ID, true);
} else {
//do nothing
}
add_action( 'save_post', 'copy_videos_to_pages', 10, 1 );
}
add_action( 'save_post', 'copy_videos_to_pages', 10, 1 );