Exemplo n.º 1
0
function enlightenment_custom_layout_form_save_postdata($post_id)
{
    if (!isset($_POST['enlightenment_custom_layout'])) {
        return $post_id;
    }
    $nonce = $_POST['enlightenment_custom_layout_form_nonce'];
    if (!wp_verify_nonce($nonce, 'enlightenment_custom_layout_form')) {
        return $post_id;
    }
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }
    $post = get_post($post_id);
    if (!current_user_can(get_post_type_object($post->post_type)->cap->edit_post, $post_id)) {
        return $post_id;
    }
    $layouts = enlightenment_custom_layouts();
    if (array_key_exists($_POST['enlightenment_custom_layout'], $layouts) || '' == $_POST['enlightenment_custom_layout']) {
        update_post_meta($post_id, '_enlightenment_custom_layout', $_POST['enlightenment_custom_layout']);
    }
}
Exemplo n.º 2
0
function enlightenment_get_layout($layout)
{
    $layouts = enlightenment_custom_layouts();
    if (isset($layouts[$layout])) {
        return $layouts[$layout];
    }
    return false;
}