Esempio n. 1
0
function et_pb_get_backbone_templates()
{
    if (!wp_verify_nonce($_POST['et_admin_load_nonce'], 'et_admin_load_nonce')) {
        die(-1);
    }
    if (!current_user_can('edit_posts')) {
        die(-1);
    }
    $post_type = sanitize_text_field($_POST['et_post_type']);
    $start_from = isset($_POST['et_templates_start_from']) ? sanitize_text_field($_POST['et_templates_start_from']) : 0;
    $amount = ET_BUILDER_AJAX_TEMPLATES_AMOUNT;
    // get the portion of templates
    $result = json_encode(ET_Builder_Element::output_templates($post_type, $start_from, $amount));
    die($result);
}