本文整理汇总了PHP中cptui_settings_tab_menu函数的典型用法代码示例。如果您正苦于以下问题:PHP cptui_settings_tab_menu函数的具体用法?PHP cptui_settings_tab_menu怎么用?PHP cptui_settings_tab_menu使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cptui_settings_tab_menu函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cptui_importexport
/**
* Create our settings page output.
*
* @since 1.0.0
*
* @return string HTML output for the page.
*/
function cptui_importexport()
{
if (!empty($_GET)) {
if (!empty($_GET['action']) && 'taxonomies' == $_GET['action']) {
$tab = 'taxonomies';
} elseif (!empty($_GET['action']) && 'get_code' == $_GET['action']) {
$tab = 'get_code';
} elseif (!empty($_GET['action']) && 'debuginfo' == $_GET['action']) {
$tab = 'debuginfo';
} else {
$tab = 'post_types';
}
}
if (!empty($_POST)) {
$notice = cptui_import_types_taxes_settings($_POST);
}
if (isset($notice)) {
echo $notice;
}
echo '<div class="wrap">';
# Create our tabs.
cptui_settings_tab_menu($page = 'importexport');
do_action('cptui_import_export_sections', $tab);
echo '</div><!-- End .wrap -->';
}
示例2: cptui_manage_taxonomies
/**
* Create our settings page output.
*
* @since 1.0.0
*
* @return string HTML output for the page.
*/
function cptui_manage_taxonomies()
{
if (!empty($_POST)) {
if (isset($_POST['cpt_submit'])) {
check_admin_referer('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
$notice = cptui_update_taxonomy($_POST);
} elseif (isset($_POST['cpt_delete'])) {
check_admin_referer('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
$notice = cptui_delete_taxonomy($_POST);
}
}
$tab = !empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action'] ? 'edit' : 'new';
?>
<div class="wrap">
<?php
if (isset($notice)) {
echo $notice;
}
# Create our tabs.
cptui_settings_tab_menu($page = 'taxonomies');
if ('edit' == $tab) {
$taxonomies = get_option('cptui_taxonomies');
$selected_taxonomy = cptui_get_current_taxonomy();
if ($selected_taxonomy) {
if (array_key_exists($selected_taxonomy, $taxonomies)) {
$current = $taxonomies[$selected_taxonomy];
}
}
}
$ui = new cptui_admin_ui();
# Will only be set if we're already on the edit screen
if (!empty($taxonomies)) {
?>
<form id="cptui_select_taxonomy" method="post">
<p><?php
_e('Select a taxonomy to edit. DO NOT EDIT the taxonomy slug unless necessary. Changing that value registers a new taxonomy entry for your install.', 'cpt-plugin');
?>
</p>
<?php
cptui_taxonomies_dropdown($taxonomies);
?>
<input type="submit" class="button-secondary" name="cptui_select_taxonomy_submit" value="<?php
echo esc_attr(apply_filters('cptui_taxonomy_submit_select', __('Select', 'cpt-plugin')));
?>
" />
</form>
<?php
}
?>
<form method="post">
<table class="form-table cptui-table">
<tr>
<td><!--LEFT SIDE-->
<table>
<?php
echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'name', 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', 'maxlength' => '32', 'onblur' => 'this.value=this.value.toLowerCase()', 'labeltext' => __('Taxonomy Slug', 'cpt-plugin'), 'aftertext' => __('(e.g. actors)', 'cpt-plugin'), 'helptext' => esc_attr__('The taxonomy name. Used to retrieve custom taxonomy content. Should be short and unique', 'cpt-plugin'), 'required' => true));
echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'label', 'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '', 'aftertext' => __('(e.g. Actors)', 'cpt-plugin'), 'labeltext' => __('Plural Label', 'cpt-plugin'), 'helptext' => esc_attr__('Taxonomy label. Used in the admin menu for displaying custom taxonomy.', 'cpt-plugin')));
echo $ui->get_text_input(array('namearray' => 'cpt_custom_tax', 'name' => 'singular_label', 'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '', 'aftertext' => __('(e.g. Actor)', 'cpt-plugin'), 'labeltext' => __('Singular Label', 'cpt-plugin'), 'helptext' => esc_attr__('Taxonomy Singular label. Used in WordPress when a singular label is needed.', 'cpt-plugin')));
echo $ui->get_tr_start() . $ui->get_th_start() . __('Attach to Post Type', 'cpt-plugin') . $ui->get_required();
echo $ui->get_th_end() . $ui->get_td_start();
/**
* Filters the arguments for post types to list for taxonomy association.
*
* @since 1.0.0
*
* @param array $value Array of default arguments.
*/
$args = apply_filters('cptui_attach_post_types_to_taxonomy', array('public' => true));
# If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
if (!is_array($args)) {
$args = array('public' => true);
}
$output = 'objects';
# or objects
$post_types = get_post_types($args, $output);
foreach ($post_types as $post_type) {
/*
* Supports Taxonomies Checkbox
*/
echo $ui->get_check_input(array('checkvalue' => $post_type->name, 'checked' => !empty($current['object_types']) && is_array($current['object_types']) && in_array($post_type->name, $current['object_types']) ? 'true' : 'false', 'name' => $post_type->name, 'namearray' => 'cpt_post_types', 'textvalue' => $post_type->name, 'labeltext' => $post_type->label, 'helptext' => sprintf(esc_attr__('Adds %s support', 'cpt-plugin'), $post_type->label), 'wrap' => false));
}
echo $ui->get_td_end() . $ui->get_tr_end();
?>
</table>
<p class="submit">
<?php
wp_nonce_field('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
if (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) {
?>
<input type="submit" class="button-primary" name="cpt_submit" value="<?php
//.........这里部分代码省略.........
示例3: cptui_manage_post_types
/**
* Create our settings page output.
*
* @since 1.0.0
*
* @return string HTML output for the page.
*/
function cptui_manage_post_types()
{
if (!empty($_POST)) {
if (isset($_POST['cpt_submit'])) {
check_admin_referer('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
$notice = cptui_update_post_type($_POST);
} elseif (isset($_POST['cpt_delete'])) {
check_admin_referer('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
$notice = cptui_delete_post_type($_POST);
}
}
$tab = !empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action'] ? 'edit' : 'new';
?>
<div class="wrap">
<?php
if (isset($notice)) {
echo $notice;
}
cptui_settings_tab_menu();
if ('edit' == $tab) {
$post_types = get_option('cptui_post_types');
$selected_post_type = cptui_get_current_post_type();
if ($selected_post_type) {
if (array_key_exists($selected_post_type, $post_types)) {
$current = $post_types[$selected_post_type];
}
}
}
$ui = new cptui_admin_ui();
# Will only be set if we're already on the edit screen
if (!empty($post_types)) {
?>
<form id="cptui_select_post_type" method="post">
<p><?php
_e('Select a post type to edit. DO NOT EDIT the post type slug unless necessary. Changing that value registers a new post type entry for your install.', 'cpt-plugin');
?>
</p>
<?php
cptui_post_types_dropdown($post_types);
?>
<input type="submit" class="button-secondary" name="cptui_select_post_type_submit" value="<?php
echo esc_attr(apply_filters('cptui_post_type_submit_select', __('Select', 'cpt-plugin')));
?>
" />
</form>
<?php
}
?>
<form method="post">
<table class="form-table cptui-table">
<tr>
<td><!--LEFT SIDE-->
<table>
<?php
/*
* Post Slug
*/
echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'name', 'textvalue' => isset($current['name']) ? esc_attr($current['name']) : '', 'maxlength' => '20', 'onblur' => 'this.value=this.value.toLowerCase()', 'labeltext' => __('Post Type Slug', 'cpt-plugin'), 'aftertext' => __('(e.g. movie)', 'cpt-plugin'), 'helptext' => esc_attr__('The post type name. Used to retrieve custom post type content. Should be short and unique', 'cpt-plugin'), 'required' => true));
/*
* Post Label
*/
echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'label', 'textvalue' => isset($current['label']) ? esc_attr($current['label']) : '', 'labeltext' => __('Plural Label', 'cpt-plugin'), 'aftertext' => __('(e.g. Movies)', 'cpt-plugin'), 'helptext' => esc_attr__('Post type label. Used in the admin menu for displaying post types.', 'cpt-plugin')));
/*
* Post Singular Slug
*/
echo $ui->get_text_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'singular_label', 'textvalue' => isset($current['singular_label']) ? esc_attr($current['singular_label']) : '', 'labeltext' => __('Singular Label', 'cpt-plugin'), 'aftertext' => __('(e.g. Movie)', 'cpt-plugin'), 'helptext' => esc_attr__('Custom Post Type Singular label. Used in WordPress when a singular label is needed.', 'cpt-plugin')));
/*
* Post Description
*/
if (isset($current['description'])) {
$current['description'] = stripslashes_deep($current['description']);
}
echo $ui->get_textarea_input(array('namearray' => 'cpt_custom_post_type', 'name' => 'description', 'rows' => '4', 'cols' => '40', 'textvalue' => isset($current['description']) ? esc_textarea($current['description']) : '', 'labeltext' => __('Description', 'cpt-plugin'), 'helptext' => esc_attr__('Custom Post Type Description. Describe what your custom post type is used for.', 'cpt-plugin')));
?>
</table>
<p class="submit">
<?php
wp_nonce_field('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
if (!empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action']) {
?>
<input type="submit" class="button-primary" name="cpt_submit" value="<?php
echo esc_attr(apply_filters('cptui_post_type_submit_edit', __('Edit Post Type', 'cpt-plugin')));
?>
" />
<input type="submit" class="button-secondary" name="cpt_delete" id="cpt_submit_delete" value="<?php
echo esc_attr(apply_filters('cptui_post_type_submit_delete', __('Delete Post Type', 'cpt-plugin')));
?>
" />
<?php
} else {
//.........这里部分代码省略.........
示例4: cptui_importexport
/**
* Create our settings page output.
*
* @since 1.0.0
*
* @return string HTML output for the page.
*/
function cptui_importexport()
{
if (!empty($_GET)) {
if (!empty($_GET['action']) && 'taxonomies' == $_GET['action']) {
$tab = 'taxonomies';
} elseif (!empty($_GET['action']) && 'get_code' == $_GET['action']) {
$tab = 'get_code';
} else {
$tab = 'post_types';
}
}
if (!empty($_POST)) {
$notice = cptui_import_types_taxes_settings($_POST);
}
if (isset($notice)) {
echo $notice;
}
echo '<div class="wrap">';
# Create our tabs.
cptui_settings_tab_menu($page = 'importexport');
if (isset($tab) && ('post_types' == $tab || 'taxonomies' == $tab)) {
?>
<p><?php
_e('If you are wanting to migrate registered post types or taxonomies from this site to another, that will also use Custom Post Type UI, use the import and export functionality. If you are moving away from Custom Post Type UI, use the information in the "Get Code" tab.', 'cpt-plugin');
?>
</p>
<p><?php
printf('<strong>%s</strong>: %s', __('NOTE', 'cpt-plugin'), __('This will not export the associated posts, just the settings.', 'cpt-plugin'));
?>
</p>
<table class="form-table cptui-table">
<?php
if (!empty($_GET) && empty($_GET['action'])) {
?>
<tr>
<td>
<h3><?php
_e('Import Post Types', 'cpt-plugin');
?>
</h3>
<form method="post">
<textarea class="cptui_post_import" placeholder="<?php
esc_attr_e('Paste content here.', 'cpt-plugin');
?>
" name="cptui_post_import"></textarea>
<p class="wp-ui-highlight"><strong><?php
_e('Note:', 'cpt-plugin');
?>
</strong> <?php
_e('Importing will overwrite previous registered settings.', 'cpt-plugin');
?>
</p>
<p><strong><?php
_e('To import post types from a different WordPress site, paste the exported content from that site and click the "Import" button.', 'cpt-plugin');
?>
</strong></p>
<p><input class="button button-primary" type="submit" value="<?php
esc_attr_e('Import', 'cpt-plugin');
?>
"/></p>
</form>
</td>
<td>
<h3><?php
_e('Export Post Types', 'cpt-plugin');
?>
</h3>
<?php
$cptui_post_types = get_option('cptui_post_types', array());
if (!empty($cptui_post_types)) {
$content = esc_html(json_encode($cptui_post_types));
} else {
$content = __('No post types registered yet.', 'cpt-plugin');
}
?>
<textarea title="<?php
esc_attr_e('To copy the system info, click below then press Ctrl + C (PC) or Cmd + C (Mac).', 'cpt-plugin');
?>
" onclick="this.focus();this.select()" readonly="readonly" class="cptui_post_import"><?php
echo $content;
?>
</textarea>
<p><strong><?php
_e('Use the content above to import current post types into a different WordPress site. You can also use this to simply back up your post type settings.', 'cpt-plugin');
?>
</strong></p>
</td>
</tr>
<?php
} elseif (!empty($_GET) && 'taxonomies' == $_GET['action']) {
?>
<tr>
//.........这里部分代码省略.........
示例5: cptui_manage_post_types
/**
* Create our settings page output.
*
* @since 1.0.0
*
* @internal
*/
function cptui_manage_post_types()
{
$post_type_deleted = false;
if (!empty($_POST)) {
if (isset($_POST['cpt_submit'])) {
check_admin_referer('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
$notice = cptui_update_post_type($_POST);
} elseif (isset($_POST['cpt_delete'])) {
check_admin_referer('cptui_addedit_post_type_nonce_action', 'cptui_addedit_post_type_nonce_field');
$notice = cptui_delete_post_type($_POST);
$post_type_deleted = true;
}
}
$tab = !empty($_GET) && !empty($_GET['action']) && 'edit' === $_GET['action'] ? 'edit' : 'new';
$tab_class = 'cptui-' . $tab;
?>
<div class="wrap <?php
echo esc_attr($tab_class);
?>
">
<?php
/**
* Fires right inside the wrap div for the post type editor screen.
*
* @since 1.3.0
*/
do_action('cptui_inside_post_type_wrap');
if (isset($notice)) {
echo $notice;
}
cptui_settings_tab_menu();
/**
* Fires below the output for the tab menu on the post type add/edit screen.
*
* @since 1.3.0
*/
do_action('cptui_below_post_type_tab_menu');
if ('edit' == $tab) {
$post_types = cptui_get_post_type_data();
$selected_post_type = cptui_get_current_post_type($post_type_deleted);
if ($selected_post_type) {
if (array_key_exists($selected_post_type, $post_types)) {
$current = $post_types[$selected_post_type];
}
}
}
$ui = new cptui_admin_ui();
// Will only be set if we're already on the edit screen.
if (!empty($post_types)) {
?>
<form id="cptui_select_post_type" method="post" action="<?php
echo esc_url(cptui_get_post_form_action($ui));
?>
">
<label for="post_type"><?php
esc_html_e('Select: ', 'custom-post-type-ui');
?>
</label>
<?php
cptui_post_types_dropdown($post_types);
/**
* Filters the text value to use on the select post type button.
*
* @since 1.0.0
*
* @param string $value Text to use for the button.
*/
?>
<input type="submit" class="button-secondary" name="cptui_select_post_type_submit" value="<?php
echo esc_attr(apply_filters('cptui_post_type_submit_select', __('Select', 'custom-post-type-ui')));
?>
" />
</form>
<?php
/**
* Fires below the post type select input.
*
* @since 1.1.0
*
* @param string $value Current post type selected.
*/
do_action('cptui_below_post_type_select', $current['name']);
}
?>
<form class="posttypesui" method="post" action="<?php
echo esc_url(cptui_get_post_form_action($ui));
?>
">
<div class="cptui-section">
<?php
//.........这里部分代码省略.........
示例6: cptui_manage_taxonomies
/**
* Create our settings page output.
*
* @since 1.0.0
*
* @internal
*/
function cptui_manage_taxonomies()
{
$taxonomy_deleted = false;
if (!empty($_POST)) {
if (isset($_POST['cpt_submit'])) {
check_admin_referer('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
$notice = cptui_update_taxonomy($_POST);
} elseif (isset($_POST['cpt_delete'])) {
check_admin_referer('cptui_addedit_taxonomy_nonce_action', 'cptui_addedit_taxonomy_nonce_field');
$notice = cptui_delete_taxonomy($_POST);
$taxonomy_deleted = true;
}
}
$tab = !empty($_GET) && !empty($_GET['action']) && 'edit' == $_GET['action'] ? 'edit' : 'new';
$tab_class = 'cptui-' . $tab;
?>
<div class="wrap <?php
echo esc_attr($tab_class);
?>
">
<?php
/**
* Fires right inside the wrap div for the taxonomy editor screen.
*
* @since 1.3.0
*/
do_action('cptui_inside_taxonomy_wrap');
if (isset($notice)) {
echo $notice;
}
// Create our tabs.
cptui_settings_tab_menu($page = 'taxonomies');
/**
* Fires below the output for the tab menu on the taxonomy add/edit screen.
*
* @since 1.3.0
*/
do_action('cptui_below_taxonomy_tab_menu');
if ('edit' == $tab) {
$taxonomies = cptui_get_taxonomy_data();
$selected_taxonomy = cptui_get_current_taxonomy($taxonomy_deleted);
if ($selected_taxonomy) {
if (array_key_exists($selected_taxonomy, $taxonomies)) {
$current = $taxonomies[$selected_taxonomy];
}
}
}
$ui = new cptui_admin_ui();
// Will only be set if we're already on the edit screen.
if (!empty($taxonomies)) {
?>
<form id="cptui_select_taxonomy" method="post" action="<?php
echo esc_url(cptui_get_post_form_action($ui));
?>
">
<label for="taxonomy"><?php
_e('Select: ', 'custom-post-type-ui');
?>
</label>
<?php
cptui_taxonomies_dropdown($taxonomies);
/**
* Filters the text value to use on the select taxonomy button.
*
* @since 1.0.0
*
* @param string $value Text to use for the button.
*/
?>
<input type="submit" class="button-secondary" name="cptui_select_taxonomy_submit" value="<?php
echo esc_attr(apply_filters('cptui_taxonomy_submit_select', __('Select', 'custom-post-type-ui')));
?>
" />
</form>
<?php
/**
* Fires below the taxonomy select input.
*
* @since 1.1.0
*
* @param string $value Current taxonomy selected.
*/
do_action('cptui_below_taxonomy_select', $current['name']);
}
?>
<form class="taxonomiesui" method="post" action="<?php
echo esc_url(cptui_get_post_form_action($ui));
?>
">
<div class="cptui-section">
//.........这里部分代码省略.........
示例7: cptui_importexport
/**
* Create our settings page output.
*
* @since 1.0.0
*
* @internal
*
* @return string HTML output for the page.
*/
function cptui_importexport()
{
$tab = '';
if (!empty($_GET)) {
if (!empty($_GET['action']) && 'taxonomies' == $_GET['action']) {
$tab = 'taxonomies';
} elseif (!empty($_GET['action']) && 'get_code' == $_GET['action']) {
$tab = 'get_code';
} elseif (!empty($_GET['action']) && 'debuginfo' == $_GET['action']) {
$tab = 'debuginfo';
} else {
$tab = 'post_types';
}
}
if (!empty($_POST)) {
$notice = cptui_import_types_taxes_settings($_POST);
}
if (isset($notice)) {
echo $notice;
}
echo '<div class="wrap">';
/**
* Fires right inside the wrap div for the import/export pages.
*
* @since 1.3.0
*/
do_action('cptui_inside_importexport_wrap');
// Create our tabs.
cptui_settings_tab_menu($page = 'importexport');
/**
* Fires inside the markup for the import/export section.
*
* Allows for more modular control and adding more sections more easily.
*
* @since 1.2.0
*
* @param string $tab Current tab being displayed.
*/
do_action('cptui_import_export_sections', $tab);
echo '</div><!-- End .wrap -->';
}