示例#1
0
        }
        $post->post_title = $_POST["post_title"];
        $post->post_content = $_POST["post_content"];
        $post->post_type = $_POST["post_type"];
        $post->post_parent = $_POST["post_parent"];
        $post->ID = wp_insert_post($post);
        // TO DO -- save custom fields
        do_action('subpost_save_form_fields', $post);
    }
    ?>
<!DOCTYPE html>
<html>
<head>
	<script>
		var display_html = '<?php 
    echo str_replace("'", "\\\\'", subpost_display_all_children($_POST["post_parent"], $post->post_type));
    ?>
';
		var win = window.dialogArguments || opener || parent || top;
		win.subpost_list_children(display_html,"<?php 
    echo $post->post_type;
    ?>
");			
	</script>
</head>
<body>	
</body>
</html><?php 
    exit;
} else {
    $mode = "add";
示例#2
0
function subpost_render_meta_box($post, $metabox)
{
    //global $post;
    //$sub_post_type_factory = SubPostTypeFactory::getInstance();
    //$post_types = $sub_post_type_factory->getPostTypes();
    //$current_sub_post_type = $post_types[$sub_post_type_factory->getCurrentPostType()];
    $current_sub_post_type = $metabox['args']['sub_post_type'];
    echo '<div id="subpost_list_children_' . $current_sub_post_type["post_type"] . '">';
    $output = subpost_display_all_children($post->ID, $current_sub_post_type["post_type"]);
    if ($output) {
        echo $output;
    } else {
        echo '<p>' . $current_sub_post_type["args"]['labels']['not_found'] . '</p>';
    }
    echo '</div>';
    //    $new_link = plugin_dir_url(__FILE__) . 'children.php?&amp;form_title=' . $current_sub_post_type["args"]['labels']['add_new_item'] . '&amp;post_parent=' . $post->ID;
    $new_link = admin_url('admin-post.php?action=subpost_form_children&amp;children.php&amp;form_title=' . $current_sub_post_type["args"]['labels']['add_new_item']) . '&amp;post_parent=' . $post->ID;
    echo '<a title="' . $current_sub_post_type["args"]['labels']['add_new_item'] . '" class="button thickbox" href="' . $new_link . '&amp;post_type=' . $current_sub_post_type["post_type"] . '&amp;TB_iframe=1&amp;width=480&amp;height=440">' . $current_sub_post_type["args"]['labels']['add_new_item'] . '</a>';
}