本文整理汇总了PHP中add_meta_box函数的典型用法代码示例。如果您正苦于以下问题:PHP add_meta_box函数的具体用法?PHP add_meta_box怎么用?PHP add_meta_box使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了add_meta_box函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_team_member_meta_boxes
/**
* Adds the resource meta boxes.
*/
function add_team_member_meta_boxes()
{
if (!is_admin()) {
return;
}
add_meta_box('fz_team_member_meta_box', esc_html__('Team Member Profile Info', 'fzp'), __NAMESPACE__ . '\\display_team_member_meta_box', get_team_members_post_type_name(), 'normal', 'default');
}
示例2: add_admin_meta_boxes
/**
* Add meta boxes to primary options pages
*
* @return void
*/
public function add_admin_meta_boxes()
{
$id = 'malware_options';
$title = __('Malware Scanning', 'it-l10n-better-wp-security');
add_meta_box($id, $title, array($this, 'metabox_malware_settings'), 'security_page_toplevel_page_itsec_settings', 'advanced', 'core');
$this->core->add_toc_item(array('id' => $id, 'title' => $title));
}
示例3: dslc_add_post_options
/**
* Add post options (add metaboxes)
*/
function dslc_add_post_options()
{
global $dslc_var_post_options;
// If there are post options
if (!empty($dslc_var_post_options)) {
// Loop through all post options
foreach ($dslc_var_post_options as $dslc_post_option_key => $dslc_post_option) {
if (!isset($dslc_post_option['context'])) {
$dslc_post_option['context'] = 'normal';
}
// If post options shown on multiple post types
if (is_array($dslc_post_option['show_on'])) {
// Loop through all post types
foreach ($dslc_post_option['show_on'] as $dslc_post_option_show_on) {
// Add meta box for post type
add_meta_box($dslc_post_option_key, $dslc_post_option['title'], 'dslc_display_post_options', $dslc_post_option_show_on, $dslc_post_option['context'], 'high');
}
// If post options shown on single post type
} else {
// Add meta box to post type
add_meta_box($dslc_post_option_key, $dslc_post_option['title'], 'dslc_display_post_options', $dslc_post_option['show_on'], $dslc_post_option['context'], 'high');
}
}
}
}
示例4: add_author_box
/**
* Adds the author box container.
*/
public function add_author_box($post_type)
{
$post_types = array('post', 'page');
if (in_array($post_type, $post_types)) {
add_meta_box('author_meta_box', __('Author of this article', 'myplugin_textdomain'), array($this, 'render_author_box'), $post_type, 'advanced', 'high');
}
}
示例5: wpcf_pr_admin_post_init_action
/**
* Init function.
*
* Enqueues styles and scripts on post edit page.
*
* @param type $post_type
* @param type $post
* @param type $groups
* @param type $wpcf_active
*/
function wpcf_pr_admin_post_init_action($post_type, $post, $groups, $wpcf_active)
{
// See if any data
$has = wpcf_pr_admin_get_has($post_type);
$belongs = wpcf_pr_admin_get_belongs($post_type);
/*
* Enqueue styles and scripts
*/
if (!empty($has) || !empty($belongs)) {
$output = wpcf_pr_admin_post_meta_box_output($post, array('post_type' => $post_type, 'has' => $has, 'belongs' => $belongs));
add_meta_box('wpcf-post-relationship', __('Post Relationship', 'wpcf'), 'wpcf_pr_admin_post_meta_box', $post_type, 'normal', 'default', array('output' => $output));
if (!empty($output)) {
wp_enqueue_script('wpcf-post-relationship', WPCF_EMBEDDED_RELPATH . '/resources/js/post-relationship.js', array('jquery', 'select2'), WPCF_VERSION);
wp_enqueue_style('wpcf-post-relationship', WPCF_EMBEDDED_RELPATH . '/resources/css/post-relationship.css', array(), WPCF_VERSION);
if (!$wpcf_active) {
wpcf_enqueue_scripts();
wp_enqueue_style('wpcf-pr-post', WPCF_EMBEDDED_RES_RELPATH . '/css/fields-post.css', array(), WPCF_VERSION);
wp_enqueue_script('wpcf-form-validation', WPCF_EMBEDDED_RES_RELPATH . '/js/' . 'jquery-form-validation/jquery.validate.min.js', array('jquery'), WPCF_VERSION);
wp_enqueue_script('wpcf-form-validation-additional', WPCF_EMBEDDED_RES_RELPATH . '/js/' . 'jquery-form-validation/additional-methods.min.js', array('jquery'), WPCF_VERSION);
}
wpcf_admin_add_js_settings('wpcf_pr_del_warning', '\'' . __('Are you sure about deleting this post?', 'wpcf') . '\'');
wpcf_admin_add_js_settings('wpcf_pr_pagination_warning', '\'' . __('If you continue without saving your changes, they might get lost.', 'wpcf') . '\'');
}
}
}
示例6: meta_boxes_post_grid
/**
* Adds a box to the main column on the Post and Page edit screens.
*/
function meta_boxes_post_grid()
{
$screens = array('post_grid');
foreach ($screens as $screen) {
add_meta_box('post_grid_metabox', __('Post Grid Options', 'post_grid'), 'meta_boxes_post_grid_input', $screen);
}
}
示例7: meta_boxes_accordions
/**
* Adds a box to the main column on the Post and Page edit screens.
*/
function meta_boxes_accordions()
{
$screens = array('accordions');
foreach ($screens as $screen) {
add_meta_box('accordions_metabox', __('Accordions Options', 'accordions'), 'meta_boxes_accordions_input', $screen);
}
}
示例8: add_meta_box
function add_meta_box()
{
if (!$this->_model->has_newsletter()) {
return false;
}
add_meta_box('eab-email-newsletter', __('e-Newsletter', Eab_EventsHub::TEXT_DOMAIN), array($this, 'create_meta_box'), 'incsub_event', 'side', 'low');
}
示例9: testimonial_add_meta_box
function testimonial_add_meta_box()
{
$screens = array('testimonial');
foreach ($screens as $screen) {
add_meta_box('myplugin_sectionid', __('Testimonial Fields', 'testimonial_meta_box'), 'testimonial_meta_box_callback', $screen);
}
}
示例10: add_seo_meta_boxes
function add_seo_meta_boxes()
{
$screens = array('post', 'page');
foreach ($screens as $screen) {
add_meta_box('op_seo_meta_box', __('SEO', OP_SN), array($this, 'meta_box'), $screen);
}
}
示例11: rename_comments_meta_box
/**
* Rename the 'Comments' meta box to 'User Contributed Notes' for reference-editing screens.
*
* @param string $post_type Post type.
* @param WP_Post $post WP_Post object for the current post.
*/
function rename_comments_meta_box($post_type, $post)
{
if (is_parsed_post_type($post_type)) {
remove_meta_box('commentsdiv', $post_type, 'normal');
add_meta_box('commentsdiv', __('User Contributed Notes', 'wporg'), 'post_comment_meta_box', $post_type, 'normal', 'high');
}
}
示例12: pt_layouts_metabox
function pt_layouts_metabox()
{
$screens = array('post', 'page');
foreach ($screens as $screen) {
add_meta_box('layout_id', __('Layout Settings', 'plumtree'), 'pt_layout_metabox_contents', $screen, 'side');
}
}
示例13: pt_add_custom_box
function pt_add_custom_box()
{
if (get_post_templates() && function_exists('add_meta_box')) {
add_meta_box('pt_post_templates', __('Single Post Template', 'pt'), 'pt_inner_custom_box', 'post', 'normal', 'high');
//add the boxes under the post
}
}
示例14: page_init
public function page_init()
{
global $klikbayi_settings, $klikbayi_sanitize;
$this->options = $klikbayi_settings;
$this->groups = $this->mb_group();
$this->default_setting = klikbayi_default_setting('reset');
$this->url = klikbayi_url('url');
$this->domain = klikbayi_url('domain');
$this->blog = klikbayi_blog();
$this->validate = $klikbayi_sanitize;
$this->type = $this->validate->type_array();
$this->style = $this->validate->style_array();
$this->plugin_data = get_plugin_data(KLIKBAYI_PLUGIN_PATH . '/klikbayi.php');
register_setting('option_klikbayi', 'klikbayi_option', array($this, 'sanitize'));
foreach ($this->groups as $t => $arr) {
add_settings_section('setting_section_' . $t, '', array($this, 'print_section_info_' . $t), 'klikbayi_option_' . $t);
add_meta_box('meta-box-' . $t, __($arr[0], 'klikbayi'), array($this, 'box_' . $t), 'klikbayi_option_' . $t, 'normal', 'high');
foreach ($arr[1] as $k => $v) {
if ('shortcode' == $k || 'sidebar' == $k) {
continue;
}
add_settings_field($k, __($v, 'klikbayi'), array($this, $k . '_cb'), 'klikbayi_option_' . $t, 'setting_section_' . $t);
}
}
}
示例15: add_map_meta_box
function add_map_meta_box()
{
$screens = array('maps');
foreach ($screens as $screen) {
add_meta_box('map_point_maker', "Points Of Interest Map", 'map_meta_box_callback', $screen, 'normal');
}
}