I am trying to add an option to create a child page from the wordpress all pages screen. I found this link, but cannot get it working properly. It is exactly what I need, but I need help fixing it
http://sltaylor.co.uk/blog/easy-child-page-creation-wordpress/
function slt_childPageAction( $actions, $page ) {
$actions["create-child"] = '<a href="/wp-admin/post-new.php?post_type=page&parent_id=' . $page->ID . '" title="Create a new page with this page as its parent">Create child</a>';
return $actions;
}
add_filter( 'page_row_actions', 'slt_childPageAction', 10, 2 );
function slt_setChildPage() {
global $post;
if ( $post->post_type == "page" && $post->post_parent == 0 && isset( $_GET["parent_id"] ) && is_numeric( $_GET["parent_id"] ) )
echo '<script type="text/javascript">jQuery( document ).ready( function($) { $("#parent_id").val("' . $_GET["parent_id"] . '"); } );</script>';
}
add_action( 'edit_page_form', 'slt_setChildPage' );