Exemplo n.º 1
0
/**
 * Registers the framework's custom metadata keys and sets up the sanitize callback function.
 *
 * @since  1.3.0
 * @access public
 * @return void
 */
function hybrid_register_meta()
{
    // Register meta if the theme supports the 'hybrid-core-template-hierarchy' feature.
    if (current_theme_supports('hybrid-core-template-hierarchy')) {
        foreach (get_post_types(array('public' => true)) as $post_type) {
            if ('page' !== $post_type) {
                register_meta('post', "_wp_{$post_type}_template", 'sanitize_text_field', '__return_false');
            }
        }
    }
    // Theme layouts meta.
    if (current_theme_supports('theme-layouts')) {
        register_meta('post', hybrid_get_layout_meta_key(), 'sanitize_key', '__return_false');
        register_meta('user', hybrid_get_layout_meta_key(), 'sanitize_key', '__return_false');
    }
    // Post styles meta.
    register_meta('post', hybrid_get_style_meta_key(), 'sanitize_text_field', '__return_false');
}
Exemplo n.º 2
0
/**
 * Deletes a post style.
 *
 * @since  3.0.0
 * @access public
 * @param  int     $post_id
 * @return bool
 */
function hybrid_delete_post_style($post_id)
{
    return delete_post_meta($post_id, hybrid_get_style_meta_key());
}