返回介绍

wp_welcome_panel()

发布于 2017-09-11 13:10:46 字数 6255 浏览 908 评论 0 收藏 0

wp_welcome_panel()

Displays a welcome panel to introduce users to WordPress.


description


源代码

File: wp-admin/includes/dashboard.php

function wp_welcome_panel() {
	?>
	<div class="welcome-panel-content">
	<h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
	<p class="about-description"><?php _e( 'We’ve assembled some links to get you started:' ); ?></p>
	<div class="welcome-panel-column-container">
	<div class="welcome-panel-column">
		<?php if ( current_user_can( 'customize' ) ): ?>
			<h3><?php _e( 'Get Started' ); ?></h3>
			<a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
		<?php endif; ?>
		<a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url( 'themes.php' ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
		<?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
			<p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), admin_url( 'themes.php' ) ); ?></p>
		<?php endif; ?>
	</div>
	<div class="welcome-panel-column">
		<h3><?php _e( 'Next Steps' ); ?></h3>
		<ul>
		<?php if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
		<?php elseif ( 'page' == get_option( 'show_on_front' ) ) : ?>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
		<?php else : ?>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
		<?php endif; ?>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li>
		</ul>
	</div>
	<div class="welcome-panel-column welcome-panel-last">
		<h3><?php _e( 'More Actions' ); ?></h3>
		<ul>
		<?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?>
			<li><div class="welcome-icon welcome-widgets-menus"><?php
				if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) {
					printf( __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ),
admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) );
				} elseif ( current_theme_supports( 'widgets' ) ) {
					echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>';
				} else {
					echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>';
				}
			?></div></li>
		<?php endif; ?>
		<?php if ( current_user_can( 'manage_options' ) ) : ?>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li>
		<?php endif; ?>
			<li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li>
		</ul>
	</div>
	</div>
	</div>
	<?php
}

更新日志

Versiondescription
3.3.0Introduced.

相关函数

Uses

  • wp-includes/capabilities.php: current_user_can()
  • wp-includes/theme.php: wp_customize_url()
  • wp-includes/theme.php: current_theme_supports()
  • wp-includes/theme.php: wp_get_themes()
  • wp-includes/l10n.php: _e()
  • wp-includes/l10n.php: __()
  • wp-includes/link-template.php: admin_url()
  • wp-includes/link-template.php: home_url()
  • wp-includes/link-template.php: get_edit_post_link()
  • wp-includes/option.php: get_option()
  • Show 5 more uses Hide more uses

User Contributed Notes

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文