本文整理汇总了PHP中genesis_is_menu_page函数的典型用法代码示例。如果您正苦于以下问题:PHP genesis_is_menu_page函数的具体用法?PHP genesis_is_menu_page怎么用?PHP genesis_is_menu_page使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了genesis_is_menu_page函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: admin_scripts
/**
* Add admin script
*
* @since 1.1.0
*/
function admin_scripts()
{
if (genesis_is_menu_page($this->page_id)) {
wp_enqueue_script('sandbox-admin', CHILD_LIB . '/js/' . gs_script_suffix('admin'), array('jquery'), CHILD_THEME_VERSION);
//wp_enqueue_script( 'sandbox-admin', CHILD_LIB . '/js/admin.js', array( 'jquery' ) , CHILD_THEME_VERSION );
}
}
示例2: genesis_load_admin_scripts
/**
* Conditionally enqueue the scripts used in the admin.
*
* Includes Thickbox, theme preview and a Genesis script (actually enqueued in genesis_load_admin_js()).
*
* @since 0.2.3
*
* @param string $hook_suffix Admin page identifier.
*/
function genesis_load_admin_scripts($hook_suffix)
{
// Only add thickbox/preview if there is an update to Genesis available.
if (genesis_update_check()) {
add_thickbox();
wp_enqueue_script('theme-preview');
genesis_load_admin_js();
}
// If we're on a Genesis admin screen.
if (genesis_is_menu_page('genesis') || genesis_is_menu_page('seo-settings') || genesis_is_menu_page('design-settings')) {
genesis_load_admin_js();
}
// If we're viewing an edit post page, make sure we need Genesis SEO JS.
if (in_array($hook_suffix, array('post-new.php', 'post.php'))) {
if (!genesis_seo_disabled() && post_type_supports(get_post_type(), 'genesis-seo')) {
genesis_load_admin_js();
}
}
}
示例3: genesis_load_admin_scripts
/**
* Conditionally enqueues the scripts used in the admin.
*
* Includes Thickbox, theme preview and a Genesis script (actually enqueued
* in genesis_load_admin_js()).
*
* @since 0.2.3
*
* @uses genesis_load_admin_js()
* @uses genesis_is_menu_page()
* @uses genesis_update_check()
* @uses genesis_seo_disabled()
*
* @global stdClass $post Post object
*
* @param string $hook_suffix Admin page identifier.
*/
function genesis_load_admin_scripts($hook_suffix)
{
/** Only add thickbox/preview if there is an update to Genesis available */
if (genesis_update_check()) {
add_thickbox();
wp_enqueue_script('theme-preview');
genesis_load_admin_js();
}
/** If we're on a Genesis admin screen */
if (genesis_is_menu_page('genesis') || genesis_is_menu_page('seo-settings') || genesis_is_menu_page('design-settings')) {
genesis_load_admin_js();
}
global $post;
/** If we're viewing an edit post page, make sure we need Genesis SEO JS */
if ('post-new.php' == $hook_suffix || 'post.php' == $hook_suffix) {
if (!genesis_seo_disabled() && post_type_supports($post->post_type, 'genesis-seo')) {
genesis_load_admin_js();
}
}
}
示例4: genesis_upgraded_notice
/**
* Displays the notice that the theme settings were successfully updated to the latest version.
*
* Currently only used for pre-release update notices.
*
* @since 1.2.0
*
* @uses genesis_get_option() Get theme setting value.
* @uses genesis_is_menu_page() Check that we're targeting a specific Genesis admin page.
*
* @return null Returns early if not on the Theme Settings page.
*/
function genesis_upgraded_notice()
{
if (!genesis_is_menu_page('genesis')) {
return;
}
if (isset($_REQUEST['upgraded']) && 'true' === $_REQUEST['upgraded']) {
echo '<div id="message" class="updated highlight"><p><strong>';
printf(__('Congratulations, you are now rocking Genesis %s! <a href="%s">See what\'s new in %s</a>.', 'genesis'), genesis_get_option('theme_version'), menu_page_url('genesis-upgraded', 0), PARENT_THEME_BRANCH);
echo '</strong></p></div>';
}
}
示例5: import
/**
* Handle the file uploaded to import settings.
*
* Upon upload, the file contents are JSON-decoded. If there were errors, or no options to import, then reload the
* page to show an error message.
*
* Otherwise, loop through the array of option sets, and update the data under those keys in the database.
* Afterwards, reload the page with a success message.
*
* Calls genesis_import action is fired after checking we can proceed, but before attempting to extract the contents
* from the uploaded file.
*
* @since 1.4.0
*
* @uses genesis_is_menu_page() Check if we're on a Genesis page
* @uses genesis_admin_redirect() Redirect user to an admin page
*
* @return null Return null if not correct admin page, we're not importing
*/
public function import()
{
if (!genesis_is_menu_page('genesis-import-export')) {
return;
}
if (empty($_REQUEST['genesis-import'])) {
return;
}
check_admin_referer('genesis-import');
do_action('genesis_import', $_REQUEST['genesis-import'], $_FILES['genesis-import-upload']);
$upload = file_get_contents($_FILES['genesis-import-upload']['tmp_name']);
$options = json_decode($upload, true);
//* Check for errors
if (!$options || $_FILES['genesis-import-upload']['error']) {
genesis_admin_redirect('genesis-import-export', array('error' => 'true'));
exit;
}
//* Identify the settings keys that we should import
$exportables = $this->get_export_options();
$importable_keys = array();
foreach ($exportables as $exportable) {
$importable_keys[] = $exportable['settings-field'];
}
//* Cycle through data, import Genesis settings
foreach ((array) $options as $key => $settings) {
if (in_array($key, $importable_keys)) {
update_option($key, $settings);
}
}
//* Redirect, add success flag to the URI
genesis_admin_redirect('genesis-import-export', array('imported' => 'true'));
exit;
}
示例6: genesis_upgraded_notice
/**
* Displays the notice that the theme settings were successfully updated to the
* latest version.
*
* @since 1.2.0
*
* @uses genesis_get_option()
*
* @return null Returns early if not on the Theme Settings page.
*/
function genesis_upgraded_notice()
{
if (!genesis_is_menu_page('genesis')) {
return;
}
if (isset($_REQUEST['upgraded']) && 'true' == $_REQUEST['upgraded']) {
echo '<div id="message" class="updated highlight" id="message"><p><strong>' . sprintf(__('Congratulations! You are now rocking Genesis %s', 'genesis'), genesis_get_option('theme_version')) . '</strong></p></div>';
}
}
示例7: genesis_disable_scribe_nag
/**
* Potentially disables Scribe admin notice.
*
* Detects a query flag, and disables the Scribe nag, then redirects the user
* back to the SEO settings page.
*
* @since 1.4.0
*
* @uses genesis_admin_redirect() Redirect to SEO Settings page after dismissing.
*
* @return null Returns early if not on the SEO Settings page, or dismiss-scribe
* querystring argument not present and set to true
*/
function genesis_disable_scribe_nag()
{
if (!genesis_is_menu_page('seo-settings')) {
return;
}
if (!isset($_REQUEST['dismiss-scribe']) || 'true' !== $_REQUEST['dismiss-scribe']) {
return;
}
update_option('genesis-scribe-nag-disabled', 1);
genesis_admin_redirect('seo-settings');
exit;
}
示例8: import
/**
* Handles the imported file.
*
* Upon upload, the file contents are JSON-decoded. If there were errors, or no
* options to import, then reload the page to show an error message.
*
* Otherwise, loop through the array of option sets, and update the data under
* those keys in the database. Afterwards, reload the page with a success message.
*
* Calls genesis_import action is fired after checking we can proceed, but
* before attempting to extract the contents from the uploaded file.
*
* @since 1.4.0
*
* @uses genesis_is_admin_page() Check if we're on a Genesis page
* @uses genesis_admin_redirect() Redirect user to an admin page
*
* @return null Returns null if not correct admin page, we're not importing
*/
public function import()
{
/** Check we're on the Import / Export page */
if (!genesis_is_menu_page('genesis-import-export')) {
return;
}
/** Check we're trying to import */
if (empty($_REQUEST['genesis-import'])) {
return;
}
/** Verify nonce */
check_admin_referer('genesis-import');
/** Hookable */
do_action('genesis_import', $_REQUEST['genesis-import'], $_FILES['genesis-import-upload']);
/** Extract file contents */
$upload = file_get_contents($_FILES['genesis-import-upload']['tmp_name']);
/** Decode the JSON */
$options = json_decode($upload, true);
/** Check for errors */
if (!$options || $_FILES['genesis-import-upload']['error']) {
genesis_admin_redirect('genesis-import-export', array('error' => 'true'));
exit;
}
/** Cycle through data, import settings */
foreach ((array) $options as $key => $settings) {
update_option($key, $settings);
}
/** Redirect, add success flag to the URI */
genesis_admin_redirect('genesis-import-export', array('imported' => 'true'));
exit;
}
示例9: notices
/**
* Display notices on the save or reset of settings.
*
* @since 1.8.0
*
* @return null Return early if not on the correct admin page.
*/
public function notices()
{
if (!genesis_is_menu_page($this->page_id)) {
return;
}
if (isset($_REQUEST['settings-updated']) && 'true' === $_REQUEST['settings-updated']) {
echo '<div id="message" class="updated"><p><strong>' . $this->page_ops['saved_notice_text'] . '</strong></p></div>';
} elseif (isset($_REQUEST['reset']) && 'true' === $_REQUEST['reset']) {
echo '<div id="message" class="updated"><p><strong>' . $this->page_ops['reset_notice_text'] . '</strong></p></div>';
} elseif (isset($_REQUEST['error']) && 'true' === $_REQUEST['error']) {
echo '<div id="message" class="updated"><p><strong>' . $this->page_ops['error_notice_text'] . '</strong></p></div>';
}
}
示例10: notices
/**
* Add notices to the top of the page when certain actions take place.
*
* Add default notices via parent::notices() as well as a few custom ones.
*
* @since 1.5.0
*
*/
function notices()
{
/** Check to verify we're on the right page */
if (!genesis_is_menu_page($this->page_id)) {
return;
}
/** Show error if can't write to server */
if (!prose_make_stylesheet_path_writable()) {
if (!is_multisite() || is_super_admin()) {
$message = __('The %s folder does not exist or is not writeable. Please create it or <a href="http://codex.wordpress.org/Changing_File_Permissions">change file permissions</a> to 777.', 'prose');
} else {
$message = __('The %s folder does not exist or is not writeable. Please contact your network administrator.', 'prose');
}
$css_path = prose_get_stylesheet_location('path');
echo '<div id="message-unwritable" class="error"><p><strong>' . sprintf($message, _get_template_edit_filename($css_path, dirname($css_path))) . '</strong></p></div>';
}
/** Genesis_Admin notices */
parent::notices();
}
示例11: notices
/**
* Add notices to the top of the page when certain actions take place.
*
* Add default notices via parent::notices() as well as a few custom ones.
*
* @since 1.5.0
*
*/
function notices()
{
/** Check to verify we're on the right page */
if (!genesis_is_menu_page($this->page_id)) {
return;
}
/** Genesis_Admin notices */
parent::notices();
}
示例12: ddw_gle_admin_body_class
/**
* Helper function to add a admin body class to plugin settings page, for
* Genesis prior v2.0.0.
*
* @since 2.0.0
*
* @return string Strings of admin body classes.
*/
function ddw_gle_admin_body_class($classes)
{
/** Check for Genesis function, otherwise bail early */
if (!function_exists('genesis_is_menu_page')) {
return;
}
/** Add admin body class */
if (genesis_is_menu_page('gle-layout-extras') && !class_exists('Genesis_Admin_CPT_Archive_Settings')) {
return $classes . ' gle-pre-g200';
}
// end if G2.0 check
}
示例13: notices
/**
* Add custom notices that display when you successfully create, edit, or delete a sidebar.
*
* @since 1.0.0
*
* @return null Returns null if not on the correct admin page.
*/
public function notices()
{
if (!genesis_is_menu_page('simple-sidebars')) {
return;
}
$pattern = '<div id="message" class="updated"><p><strong>%s</strong></p></div>';
if (isset($_REQUEST['created']) && 'true' === $_REQUEST['created']) {
printf($pattern, __('New sidebar successfully created!', 'ss'));
return;
}
if (isset($_REQUEST['edited']) && 'true' === $_REQUEST['edited']) {
printf($pattern, __('Sidebar successfully edited!', 'ss'));
return;
}
if (isset($_REQUEST['deleted']) && 'true' === $_REQUEST['deleted']) {
printf($pattern, __('Sidebar successfully deleted.', 'ss'));
return;
}
return;
}