本文整理汇总了PHP中get_admin_url函数的典型用法代码示例。如果您正苦于以下问题:PHP get_admin_url函数的具体用法?PHP get_admin_url怎么用?PHP get_admin_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_admin_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
/**
*
* @param array $current_import
* @return bool
*/
function import(array $current_import)
{
// fetch the remote content
$html = wp_remote_get($current_import['file']);
// Something failed
if (is_wp_error($html)) {
$redirect_url = get_admin_url(get_current_blog_id(), '/tools.php?page=pb_import');
error_log('\\PressBooks\\Import\\Html import error, wp_remote_get() ' . $html->get_error_message());
$_SESSION['pb_errors'][] = $html->get_error_message();
$this->revokeCurrentImport();
\Pressbooks\Redirect\location($redirect_url);
}
$url = parse_url($current_import['file']);
// get parent directory (with forward slash e.g. /parent)
$path = dirname($url['path']);
$domain = $url['scheme'] . '://' . $url['host'] . $path;
// get id (there will be only one)
$id = array_keys($current_import['chapters']);
// front-matter, chapter, or back-matter
$post_type = $this->determinePostType($id[0]);
$chapter_parent = $this->getChapterParent();
$body = $this->kneadandInsert($html['body'], $post_type, $chapter_parent, $domain);
// Done
return $this->revokeCurrentImport();
}
示例2: subscribe_if_not_subscribed
public function subscribe_if_not_subscribed()
{
global $bc_accounts;
$accounts = $bc_accounts->get_sanitized_all_accounts();
$completed_accounts = array();
foreach ($accounts as $account => $account_data) {
// We may have multiple accounts for an account_id, prevent syncing that account more than once.
if (!in_array($account_data['account_id'], $completed_accounts)) {
$completed_accounts[] = $account_data['account_id'];
$bc_accounts->set_current_account($account);
$subscriptions = $this->cms_api->get_subscriptions();
if (is_array($subscriptions)) {
foreach ($subscriptions as $subscription) {
if ($bc_accounts->get_account_id() === $subscription['service_account'] && isset($subscription['id']) && false !== strpos($subscription['endpoint'], get_admin_url())) {
$this->cms_api->remove_subscription($subscription['id']);
}
}
}
$subscription_status = $this->cms_api->add_subscription();
if (is_wp_error($subscription_status)) {
$bc_accounts->restore_default_account();
return false;
}
if (isset($subscription_status['id']) && $subscription_status['service_account'] === $bc_accounts->get_account_id()) {
$subscription_id = BC_Utility::sanitize_subscription_id($subscription_status['id']);
update_option($this->get_option_key_for($bc_accounts->get_account_id()), $subscription_id);
}
$bc_accounts->restore_default_account();
}
}
}
示例3: nebula_admin_bar_nebula_wireframing
function nebula_admin_bar_nebula_wireframing($wp_admin_bar)
{
$wp_admin_bar->add_node(array('id' => 'nebula-wireframing', 'title' => '<i class="fa fa-fw fa-sitemap" style="font-family: \'FontAwesome\'; color: #a0a5aa; color: rgba(240,245,250,.6); margin-right: 5px;"></i> Wireframing Enabled', 'href' => get_admin_url() . 'themes.php?page=nebula_options'));
$wp_admin_bar->add_node(array('parent' => 'nebula-wireframing', 'id' => 'nebula-wireframing-help', 'title' => '<i class="nebula-admin-fa fa fa-fw fa-question" style="font-family: \'FontAwesome\'; color: #a0a5aa; color: rgba(240, 245, 250, .6); margin-right: 5px;"></i> Help & Documentation »', 'href' => 'https://gearside.com/nebula/documentation/custom-functionality/wireframing/', 'meta' => array('target' => '_blank')));
$wp_admin_bar->remove_menu('wpseo-menu');
//SEO menu not important during wireframing
}
示例4: eventon_admin_help_tab_content
/** Help Tab Content*/
function eventon_admin_help_tab_content()
{
$screen = get_current_screen();
ob_start();
?>
<p><b>EventON WP Event Calendar General Information.</b></p>
<p><a class='evo_admin_btn btn_prime' href='<?php
echo get_admin_url();
?>
index.php?page=evo-getting-started'>Getting started guide to eventON</a></p>
<p>All the updated documentation for eventON can be found from our <a class='evo_admin_btn btn_triad'href='http://www.myeventon.com/documentation/'>online documentation library.</a></p>
<?php
$content = ob_get_clean();
ob_start();
?>
<p><b>Support for EventON Calendar</b></p>
<p>We provide support for issues directly related to eventON calendar via our <a href='http://helpdesk.ashanjay.com' target='_blank' class='evo_admin_btn btn_triad'>HelpDesk</a> EventON valid purchase code is required to access helpdesk if eventON came bundled with your theme.</p>
<p>Before creating a ticket, please check the troubleshooter guide that can very well help you solve your issue by trying our common solutions.</p>
<p>Please check out our <a href='http://www.myeventon.com/documentation/check-eventon-working/' class='evo_admin_btn btn_triad' target='_blank' >troubleshooter guide to eventon</a></p>
<?php
$support = ob_get_clean();
$screen->add_help_tab(array('id' => 'eventon_overview_tab', 'title' => __('General', 'eventon'), 'content' => $content));
$screen->add_help_tab(array('id' => 'eventon_overview_tab_s', 'title' => __('Support', 'eventon'), 'content' => $support));
$screen->set_help_sidebar('<p><strong>' . __('For more information:', 'eventon') . '</strong></p>' . '<p><a href="http://www.myeventon.com/" target="_blank">' . __('EventON', 'eventon') . '</a></p>' . '<p><a href="http://www.myeventon.com/changelog/" target="_blank">' . __('Changelog', 'eventon') . '</a></p>' . '<p><a href="http://www.myeventon.com/documentation/" target="_blank">' . __('Documentation', 'eventon') . '</a></p>' . '<p><a href="http://www.myeventon.com/addons/" target="_blank">' . __('Addons', 'eventon') . '</a></p>' . '<p><a href="http://helpdesk.ashanjay.com" target="_blank">' . __('Helpdesk', 'eventon') . '</a></p>');
}
示例5: rt_of_options_array
function rt_of_options_array()
{
$of_options = array();
/*-----------------------------------------------------------------------------------*/
/* The Options Array */
/*-----------------------------------------------------------------------------------*/
// Theme Setup
$of_options[] = array("name" => __("Theme Setup", RT_LANGUAGE), "id" => "theme_setup", "type" => "heading");
$of_options[] = array("name" => __("Register page link", RT_LANGUAGE), "id" => "theme_setup_register_page_link", "std" => "", "type" => "text");
$of_options[] = array("name" => __("Enable admin theme", RT_LANGUAGE), "id" => "theme_setup_admin_theme", "std" => "default", "type" => "select", "options" => array("default" => __("Default", RT_LANGUAGE), "admin-theme-1" => __("Admin Theme 1", RT_LANGUAGE)));
$of_options[] = array("name" => __("Support Developer Level 1", RT_LANGUAGE), "id" => "theme_setup_developer_level_1", "std" => 1, "on" => "Enable", "off" => "Disable", "type" => "switch");
$of_options[] = array("name" => __("Enable Customer Support", RT_LANGUAGE), "desc" => __('Disable this feature If you are a developer', RT_LANGUAGE), "id" => "theme_setup_customer_support", "std" => 1, "on" => "Enable", "off" => "Disable", "type" => "switch");
$of_options[] = array("name" => __("Enable Top Header", RT_LANGUAGE), "id" => "theme_setup_top_header", "std" => 0, "on" => "Enable", "off" => "Disable", "type" => "switch");
$of_options[] = array("name" => __("Enable Banner side out", RT_LANGUAGE), "desc" => __('Enable to use banner side out. Click <a target="_blank" href="' . get_admin_url() . '/options-general.php?page=float_left_right_ads.php">Here</a> to setup banner', RT_LANGUAGE), "id" => "theme_setup_banner_side_out_enable", "std" => 0, "on" => "Enable", "off" => "Disable", "type" => "switch");
$of_options[] = array("name" => __("Enable Statistic", RT_LANGUAGE), "desc" => __('Enabled Statistics to measure website traffic', RT_LANGUAGE), "id" => "theme_setup_statistics", "std" => 0, "on" => "Enable", "off" => "Disable", "type" => "switch");
// Single Woocommerce
$of_options[] = array("name" => __("Custom Woocommerce", RT_LANGUAGE), "id" => "custom_woocommerce", "type" => "heading");
$of_options[] = array("name" => __("Enable Compare Products", RT_LANGUAGE), "desc" => __('Enable/Disable Compare products. Click <a target="_blank" href="' . get_admin_url() . '/admin.php?page=yith_woocompare_panel">Here</a> to setup feature.', RT_LANGUAGE), "id" => "woocommerce_compare_products", "std" => 0, "on" => "Enable", "off" => "Disable", "type" => "switch");
$of_options[] = array("name" => __("Enable Wishlist Products", RT_LANGUAGE), "desc" => __('Enable/Disable Wishlist products.', RT_LANGUAGE), "id" => "woocommerce_wishlist_products", "std" => 0, "on" => "Enable", "off" => "Disable", "type" => "switch");
$of_options[] = array("name" => __("Shop Page", RT_LANGUAGE), "desc" => "", "id" => "shop_page_code", "std" => "<h3 style='margin: 0;'>" . __("Shop Page", RT_LANGUAGE) . "</h3>", "icon" => true, "type" => "info");
$of_options[] = array("name" => __("Shop Page Filter Display?", RT_LANGUAGE), "desc" => __("Enable/Disable filter on shop page", RT_LANGUAGE), "id" => "woocommerce_shop_filter_display", "std" => 0, "on" => "Enable", "off" => "Disable", "type" => "switch");
$of_options[] = array("name" => __("Shop Page Thumbnail Hover Effect", RT_LANGUAGE), "desc" => __("Choose Thumbnail Hover Effect in Shop Page", RT_LANGUAGE), "id" => "woocommerce_shop_thumb_hover_effect", "std" => "default", "type" => "select", "options" => array("default" => __("Default", RT_LANGUAGE), "hover-zoom" => __("Zoom Thumbnail", RT_LANGUAGE)));
$of_options[] = array("name" => __("Shop Page Thumbnail Click Effect", RT_LANGUAGE), "desc" => __("Choose Thumbnail Click Effect in Shop Page", RT_LANGUAGE), "id" => "woocommerce_shop_thumb_click_effect", "std" => "default", "type" => "select", "options" => array("default" => __("Default", RT_LANGUAGE), "popup-image" => __("Popup Image", RT_LANGUAGE), "popup-image-zoom" => __("Popup Image and Zoom", RT_LANGUAGE), "popup-gallery" => __("Popup Gallery", RT_LANGUAGE), "popup-gallery-zoom" => __("Popup Gallery and Zoom", RT_LANGUAGE)));
$of_options[] = array("name" => __("Single Product", RT_LANGUAGE), "desc" => "", "id" => "single_product_code", "std" => "<h3 style='margin: 0;'>" . __("Single Product", RT_LANGUAGE) . "</h3>", "icon" => true, "type" => "info");
$of_options[] = array("name" => __("Enable Zoom Thumbnail", RT_LANGUAGE), "desc" => __('Enable to use zoom thumbnail effect. Click <a target="_blank" href="' . get_admin_url() . '/admin.php?page=yith_woocommerce_zoom-magnifier_panel">Here</a> to setup effect.', RT_LANGUAGE), "id" => "woocommerce_product_zoom_thumb", "std" => 0, "on" => "Enable", "off" => "Disable", "type" => "switch");
$of_options[] = array("name" => __("Single Product thumbnail gallery design", RT_LANGUAGE), "desc" => __("Choose if the thumbnail gallery on the single product page are vertical or horizontal.", RT_LANGUAGE), "id" => "woocommerce_product_thumb_design", "std" => "horizontal", "type" => "select", "options" => array("horizontal" => __("Horizontal Design", RT_LANGUAGE), "vertical" => __("Vertical Design", RT_LANGUAGE)));
// Custom Blog
$of_options[] = array("name" => __("Custom Blog", RT_LANGUAGE), "id" => "heading_custom_blog", "type" => "heading");
$of_options[] = array("name" => __("General Blog Options", "Avada"), "desc" => "", "id" => "custom_blog_single_post", "std" => "<h3 style='margin: 0;'>" . __("General Blog Options", "Avada") . "</h3>", "icon" => true, "type" => "info");
$of_options[] = array("name" => __("Blog Archive/Category Layout", RT_LANGUAGE), "desc" => __("Select the layout for the blog archive/category pages.", RT_LANGUAGE), "id" => "custom_blog_archive_layout", "std" => "Large", "type" => "select", "options" => array('' => 'None', 'medium-1' => 'Medium 1'));
return $of_options;
}
示例6: dt_metabox_benefits_options
function dt_metabox_benefits_options($post)
{
$box_name = 'dt_benefits_options';
$defaults = array('retina_image' => '', 'retina_image_w' => 0, 'retina_image_h' => 0, 'retina_image_id' => null);
$opts = get_post_meta($post->ID, '_' . $box_name, true);
$opts = wp_parse_args(maybe_unserialize($opts), $defaults);
// Use nonce for verification
wp_nonce_field(plugin_basename(__FILE__), $box_name . '_nonce');
// image
$img_id = '<input type="hidden" value="' . $opts['retina_image_id'] . '" class="dt-uploader-textfield dt-get-id" name="' . $box_name . '_retina_image_id" />';
// upload button
$upload = dt_melement('link', array('description' => _x('Upload Image', 'backend benefits', LANGUAGE_ZONE), 'class' => 'dt-uploader-opener button-primary thickbox', 'href' => get_admin_url() . 'media-upload.php?post_id=' . $post->ID . '&type=image&TB_iframe=1&width=640&height=310'));
// delete button
$delete = dt_melement('link', array('description' => _x('Clear', 'backend benefits', LANGUAGE_ZONE), 'class' => 'dt-uploader-delete button', 'href' => '#'));
?>
<p class="dt_switcher-box"><?php
if ($opts['retina_image_id']) {
$img = wp_get_attachment_image_src($opts['retina_image_id'], 'medium');
if ($img) {
$size = wp_constrain_dimensions($img[1], $img[2], 266, 266);
echo '<img class="attachment-266x266 dt-thumb" src="' . $img[0] . '" ' . image_hwstring($size[0], $size[1]) . ' />';
}
}
echo $img_id . $upload . $delete;
?>
</p>
<?php
}
示例7: setopt_admin_notice
/**
* Print a reminder message for set the options after the theme is installed or updated
*/
function setopt_admin_notice()
{
$screen = get_current_screen();
if (current_user_can('manage_options') && $screen->id !== 'appearance_page_fastfood_options' && version_compare(FastfoodOptions::get_opt('version', '0'), fastfood_get_info('version'), '<')) {
echo '<div class="update-nag"><strong>' . sprintf(__('%1$s theme says: Dont forget to set <a href="%2$s">my options</a>!', 'fastfood'), 'Fastfood', get_admin_url() . 'themes.php?page=' . $this->option_name) . '</strong></div>';
}
}
示例8: _validate_form
protected function _validate_form()
{
if (isset($_POST['vimeography_basic_settings']) && check_admin_referer('vimeography-gallery-action', 'vimeography-gallery-verification')) {
try {
$input = $_POST['vimeography_basic_settings'];
if (empty($input['gallery_title']) or empty($input['source_url'])) {
throw new Exception(__('Make sure you fill out all of the fields below!'));
}
global $wpdb;
$settings['gallery_title'] = $wpdb->escape(wp_filter_nohtml_kses($input['gallery_title']));
$settings['source_url'] = $wpdb->escape(wp_filter_nohtml_kses($input['source_url']));
$result = $wpdb->insert(VIMEOGRAPHY_GALLERY_TABLE, array('title' => $settings['gallery_title'], 'date_created' => current_time('mysql'), 'is_active' => 1));
if (!$result) {
throw new Exception(__('We couldn\'t create a new gallery. Try upgrading or reinstalling the Vimeography plugin.'));
} else {
$gallery_id = $wpdb->insert_id;
$result = $wpdb->insert(VIMEOGRAPHY_GALLERY_META_TABLE, array('gallery_id' => $gallery_id, 'source_url' => $settings['source_url'], 'video_limit' => 20, 'featured_video' => NULL, 'gallery_width' => NULL, 'cache_timeout' => 3600, 'theme_name' => 'bugsauce'));
if (!$result) {
throw new Exception(__('We couldn\'t save your gallery settings. Try reinstalling the Vimeography plugin.'));
}
}
wp_redirect(get_admin_url() . 'admin.php?page=vimeography-edit-galleries&id=' . $gallery_id . '&created=1');
exit;
} catch (Exception $e) {
require_once ABSPATH . 'wp-admin/admin-header.php';
$this->messages[] = array('type' => 'error', 'heading' => 'Ruh roh.', 'message' => $e->getMessage());
}
}
}
示例9: add_switcher
function add_switcher()
{
// Tester si le multisite est activié
if (!function_exists('is_multisite') || !is_multisite()) {
return false;
}
// Blogs de l'utilisateur actuel
global $current_user;
$blogs = get_blogs_of_user($current_user->id, true);
// Il faut plus d'un blog pour avoir le menu déroulant
if (count($blogs) <= 1) {
return false;
}
$current_blogurl = get_bloginfo('url');
echo '<form style="float:left;min-width:150px;margin:10px 0 0 40px;" action="" method="post">';
wp_nonce_field('multisite-switcher');
echo 'Switch Backend: ';
echo '<select onchange="location.href=this.value;" id="multisiteswitcher" name="multisiteswitcher">';
foreach ($blogs as $blog) {
echo '<option ' . selected($blog->siteurl, $current_blogurl, false) . ' value="' . esc_url(get_admin_url($blog->userblog_id)) . '">' . $blog->blogname . '</option>';
}
echo '</select>';
echo '<noscript> <input class="button-secondary action" type="submit" value="Go"/></noscript>';
echo '</form>';
}
示例10: update_notifier_bar_menu
function update_notifier_bar_menu()
{
if (function_exists('simplexml_load_string')) {
// Stop if simplexml_load_string funtion isn't available
global $wp_admin_bar, $wpdb;
if (!is_super_admin() || !is_admin_bar_showing()) {
// Don't display notification in admin bar if it's disabled or the current user isn't an administrator
return;
}
$xml = get_latest_theme_version(NOTIFIER_CACHE_INTERVAL);
// Get the latest remote XML file on our server
// get version
if (function_exists('wp_get_theme')) {
$theme_data = wp_get_theme(get_template());
$version = $theme_data->version;
} else {
$theme_data = get_theme_data(get_template_directory() . '/style.css');
$version = $theme_data['Version'];
}
if (!is_object($xml)) {
return;
}
if (version_compare($xml->latest, $version, '>')) {
// Compare current theme version with the remote XML version
$wp_admin_bar->add_menu(array('id' => 'update_notifier', 'title' => '<span>' . NOTIFIER_THEME_NAME . ' <span id="ab-updates">1 Update</span></span>', 'href' => get_admin_url() . 'index.php?page=theme-update-notifier'));
}
}
}
示例11: wpmuNewBlog
/**
* Runs activation function and sets up default WP options for new blog,
* a.k.a. when a registered user creates a new blog
*
* @param int $blog_id
* @param int $user_id
*
* @see add_action( 'wpmu_new_blog', ... )
*/
function wpmuNewBlog($blog_id, $user_id)
{
$this->blog_id = (int) $blog_id;
$this->user_id = (int) $user_id;
switch_to_blog($this->blog_id);
if (!$this->isBookSetup()) {
$this->wpmuActivate();
array_walk($this->opts, function ($v, $k) {
if (empty($v)) {
delete_option($k);
} else {
update_option($k, $v);
}
});
wp_cache_flush();
}
// Set current metadata version to skip redundant upgrade routines
update_option('pressbooks_metadata_version', \Pressbooks\Metadata::$currentVersion);
flush_rewrite_rules(false);
do_action('pressbooks_new_blog');
restore_current_blog();
if (is_user_logged_in()) {
(new \Pressbooks\Catalog())->deleteCache();
\Pressbooks\Redirect\location(get_admin_url($this->blog_id));
}
}
示例12: ubermenu_update_notifier_bar_menu
function ubermenu_update_notifier_bar_menu()
{
global $uberMenu;
if (!$uberMenu->getSettings()->op('update-alerts')) {
return;
}
if (!function_exists('simplexml_load_string')) {
return;
}
global $wp_admin_bar, $wpdb;
if (!is_super_admin() || !is_admin_bar_showing()) {
return;
}
$xml = ubermenu_get_latest_plugin_version(UBERMENU_UPDATE_DELAY);
//21600); // This tells the function to cache the remote call for 21600 seconds (6 hours)
$plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/ubermenu/ubermenu.php');
// Get plugin data (current version is what we want)
if (!$xml) {
//we can't retrieve the XML file and parse it properly
return;
}
if (version_compare($plugin_data['Version'], $xml->latest) == -1) {
$wp_admin_bar->add_menu(array('id' => 'ubermenu_update_notifier', 'title' => '<span> ' . __('UberMenu', 'ubermenu') . ' <span id="ab-updates">' . __('New Updates', 'ubermenu') . '</span></span>', 'href' => get_admin_url() . 'themes.php?page=uber-menu&updates=1'));
}
}
示例13: create_tools_page
/**
* create_tools_page.
*
* @version 2.3.10
*/
function create_tools_page()
{
// Tabs
$tabs = apply_filters('wcj_tools_tabs', array(array('id' => 'dashboard', 'title' => __('Tools Dashboard', 'woocommerce-jetpack'))));
$html = '<h2 class="nav-tab-wrapper woo-nav-tab-wrapper">';
$active_tab = isset($_GET['tab']) ? $_GET['tab'] : 'dashboard';
foreach ($tabs as $tab) {
$is_active = $active_tab === $tab['id'] ? 'nav-tab-active' : '';
$html .= '<a href="' . add_query_arg(array('page' => 'wcj-tools', 'tab' => $tab['id']), get_admin_url() . 'admin.php') . '" class="nav-tab ' . $is_active . '">' . $tab['title'] . '</a>';
}
$html .= '</h2>';
echo $html;
// Content
if ('dashboard' === $active_tab) {
$title = __('Booster for WooCommerce Tools - Dashboard', 'woocommerce-jetpack');
$desc = __('This dashboard lets you check statuses and short descriptions of all available Booster for WooCommerce tools. Tools can be enabled through WooCommerce > Settings > Booster. Enabled tools will appear in the tabs menu above.', 'woocommerce-jetpack');
echo '<h3>' . $title . '</h3>';
echo '<p>' . $desc . '</p>';
echo '<table class="widefat" style="width:90%;">';
echo '<tr>';
echo '<th style="width:20%;">' . __('Tool', 'woocommerce-jetpack') . '</th>';
echo '<th style="width:20%;">' . __('Module', 'woocommerce-jetpack') . '</th>';
echo '<th style="width:50%;">' . __('Description', 'woocommerce-jetpack') . '</th>';
echo '<th style="width:10%;">' . __('Status', 'woocommerce-jetpack') . '</th>';
echo '</tr>';
do_action('wcj_tools_' . 'dashboard');
echo '</table>';
} else {
do_action('wcj_tools_' . $active_tab);
}
}
示例14: registerPostType
/**
* Registering a post type
*
* @param string $type slug of the type
* @param string $singular singular name
* @param string $plural plural name
* @param array $config can override the defaults of this function (array_merge)
*/
public static function registerPostType($type, $singular, $plural, $config = array())
{
$labels = array('name' => $plural, 'singular_name' => $singular, 'add_new' => 'Erstellen', 'add_new_item' => $singular . ' erfassen', 'edit_item' => 'Bearbeite ' . $singular, 'new_item' => 'Neues ' . $singular, 'view_item' => $singular . ' ansehen', 'search_items' => $singular . ' suchen', 'not_found' => 'Keine ' . $plural . ' gefunden', 'not_found_in_trash' => 'Keine ' . $plural . ' im Papierkorb gefunden', 'parent_item_colon' => '');
$defaults = array('labels' => $labels, 'public' => true, 'has_archive' => true, 'plural_view_adminbar' => false);
$arguments = array_merge_recursive_distinct($defaults, $config);
if (isset($arguments['plural_view_adminbar']) && $arguments['plural_view_adminbar']) {
add_action('admin_bar_menu', function ($wp_admin_bar) use($type, $arguments) {
$object = get_queried_object();
if ($object->name == $type) {
$title = $object->labels->menu_name;
if (is_admin()) {
$url = get_post_type_archive_link($type);
} else {
$url = get_admin_url(null, 'edit.php?post_type=' . $type);
}
}
if ($object->post_type == $type) {
if (!is_admin()) {
$url = get_edit_post_link($object->ID);
$title = $arguments['labels']['edit_item'];
}
}
// Add admin bar entry
if ($url) {
$wp_admin_bar->add_node(array('id' => 'custom-button', 'title' => $title, 'href' => $url));
}
}, 95);
}
register_post_type($type, $arguments);
}
示例15: WPMDBUG_toolbar_link
/**
* Show a link to the WP Email Debug settings page in the toolbar indicating
* the debugging functionality is enabled.
*
* @since 1.0.0
* @return void
*/
function WPMDBUG_toolbar_link($wp_admin_bar)
{
if (WPMailDebugger::doEnforce()) {
$args = array('id' => 'WPMDBUG-toolbar', 'title' => 'Email Debug ON', 'href' => get_admin_url(NULL, 'options-general.php?page=wpmdbug'));
$wp_admin_bar->add_node($args);
}
}