Exemplo n.º 1
0
/**
 * Call this function to add a field to an (existing) metabox container
 *
 * @since 0.2
 *
 * @param string $callback Required. Function that outputs the markup for this field
 * @param string $box_id Required. HTML 'id' attribute of the box this field goes into
 *
 * TODO: Implement some sort of weighting protocol to control ordering of fields within a metabox (right now it's just FIFO)
 */
function largo_add_meta_content($callback, $box_id)
{
    global $largo;
    // Create this metabox if one hasn't been defined... assumes just 'post'
    if (!array_key_exists($box_id, $largo['meta']['boxes'])) {
        largo_add_meta_box($box_id, 'Meta Information');
    }
    // Add this field to the array
    $largo['meta']['boxes'][$box_id]['callbacks'][] = $callback;
}
Exemplo n.º 2
0
add_filter('default_hidden_meta_boxes', 'largo_change_default_hidden_metaboxes', 10, 2);
/**
 * Creates custom meta boxes to the post edit screens using the Largo Metabox API
 * Which lives in inc/metabox-api.php
 *
 * @since 0.4
 */
// Related posts controls
largo_add_meta_box('largo_additional_options', __('Additional Options', 'largo'), 'largo_custom_related_meta_box_display', 'post', 'side', 'core');
// Related posts controls
largo_add_meta_box('largo_byline_meta', __('Custom Byline Options', 'largo'), 'largo_byline_meta_box_display', of_get_option('custom_landing_enabled') ? array('post', 'cftl-tax-landing') : 'post', 'side', 'core');
// Layout options for post templates, custom sidebars
largo_add_meta_box('largo_layout_meta', __('Layout Options', 'largo'), 'largo_layout_meta_box_display', array('post', 'page'), 'side', 'core');
// Disclaimer
if (of_get_option('disclaimer_enabled')) {
    largo_add_meta_box('largo_custom_disclaimer', __('Disclaimer', 'largo'), 'largo_custom_disclaimer_meta_box_display', 'post', 'normal', 'core');
}
/**
 * Add our prominence taxonomy meta box with custom behavior.
 *
 * @param array $largoProminenceTerms list of prominence terms
 * @see largo_custom_taxonomies
 */
function largo_add_custom_prominence_meta_box($largoProminenceTerms)
{
    add_action('add_meta_boxes', function () use($largoProminenceTerms) {
        add_meta_box('largo_prominence_meta', __('Post Prominence', 'largo'), 'largo_prominence_meta_box', 'post', 'side', 'default', $largoProminenceTerms);
    }, 10);
}
add_action('largo_after_create_prominence_taxonomy', 'largo_add_custom_prominence_meta_box', 10, 1);
/**