本文整理汇总了PHP中wp_page_menu函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_page_menu函数的具体用法?PHP wp_page_menu怎么用?PHP wp_page_menu使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_page_menu函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ecvetstep_primary_menu
/**
* Shows the Primary Menu
*
* default load in sidebar-header-right.php
*/
function ecvetstep_primary_menu()
{
?>
<div id="header-menu">
<nav id="access" role="navigation">
<h2 class="assistive-text"><?php
_e('Primary Menu', 'ecvetstep');
?>
</h2>
<div class="assistive-text skip-link"><a href="#content" title="<?php
esc_attr_e('Skip to content', 'ecvetstep');
?>
"><?php
_e('Skip to content', 'ecvetstep');
?>
</a></div>
<?php
if (has_nav_menu('primary')) {
$ecvetstep_primary_menu_args = array('theme_location' => 'primary', 'container_class' => 'menu-header-container', 'items_wrap' => '<ul class="menu">%3$s</ul>');
wp_nav_menu($ecvetstep_primary_menu_args);
} else {
echo '<div class="menu-header-container">';
wp_page_menu(array('menu_class' => 'menu'));
echo '</div>';
}
?>
</nav><!-- .site-navigation .main-navigation -->
</div>
<?php
}
示例2: page_menu
/**
* Default fallback_cb, but filtered with new classnames and nav_menu_container
*/
public function page_menu($args)
{
add_filter('wp_page_menu', array($this, 'nav_menu_container'), 10, 2);
add_filter('wp_page_menu', array($this, 'shim_classnames'), 10, 2);
wp_page_menu($args);
remove_filter('wp_page_menu', array($this, 'nav_menu_container'), 10, 2);
remove_filter('wp_page_menu', array($this, 'shim_classnames'), 10, 2);
}
示例3: bpmagic_main_nav_fallback
function bpmagic_main_nav_fallback($args)
{
$pages_args = array('depth' => 0, 'echo' => false, 'exclude' => '', 'title_li' => '');
$menu = wp_page_menu($pages_args);
$menu = str_replace(array('<div class="menu"><ul>', '</ul></div>'), array('<ul id="nav">', '</ul><!-- #nav -->'), $menu);
echo $menu;
do_action('bp_nav_items');
}
示例4: fallback
public function fallback($args)
{
if ($args["theme_location"] === "main") {
add_filter("wp_page_menu", array(&$this, "wp_page_menu_filter"));
wp_page_menu(array("depth" => 1, "menu_class" => "menu"));
remove_filter("wp_page_menu", array(&$this, "wp_page_menu_filter"));
}
}
示例5: rock_add_primary_menu
/**
* Add primary menu.
*
* @action rock_site_navigation
* @since 1.0.0
*/
function rock_add_primary_menu()
{
if (!has_nav_menu('primary')) {
wp_page_menu(array('depth' => 1, 'show_home' => true));
return;
}
wp_nav_menu(array('theme_location' => 'primary', 'walker' => new Rock_Walker_Nav_Menu()));
}
示例6: catchadaptive_primary_menu
/**
* Shows the Primary Menu
*
* default load in sidebar-header.php
*/
function catchadaptive_primary_menu()
{
$options = catchadaptive_get_theme_options();
?>
<nav class="nav-primary" role="navigation">
<div class="wrapper">
<div class="screen-reader-text skip-link"><a href="#content" title="<?php
esc_attr_e('Skip to content', 'catchadaptive');
?>
"><?php
_e('Skip to content', 'catchadaptive');
?>
</a></div>
<?php
if (has_nav_menu('primary')) {
$classes = "mobile-menu-anchor primary-menu";
} else {
$classes = "mobile-menu-anchor page-menu";
}
?>
<div id="mobile-header-left-menu" class="<?php
echo $classes;
?>
">
<a href="#mobile-header-left-nav" id="header-left-menu" class="genericon genericon-menu">
<span class="mobile-menu-text"><?php
_e('Menu', 'catchadaptive');
?>
</span>
</a>
</div><!-- #mobile-header-menu -->
<?php
$logo_alt = '' != $options['logo_alt_text'] ? $options['logo_alt_text'] : get_bloginfo('name', 'display');
if (isset($options['logo_icon']) && $options['logo_icon'] != '' && !empty($options['logo_icon'])) {
echo '<div id="logo-icon"><a href="' . esc_url(home_url('/')) . '" title="' . esc_attr(get_bloginfo('name', 'display')) . '" rel="home">
<img src="' . esc_url($options['logo_icon']) . '" alt="' . esc_attr($logo_alt) . '">
</a></div>';
}
echo '<h1 class="assistive-text">' . __('Primary Menu', 'catchadaptive') . '</h1>';
if (has_nav_menu('primary')) {
$catchadaptive_primary_menu_args = array('theme_location' => 'primary', 'menu_class' => 'menu catchadaptive-nav-menu', 'container' => false);
wp_nav_menu($catchadaptive_primary_menu_args);
} else {
wp_page_menu(array('menu_class' => 'menu catchadaptive-nav-menu'));
}
?>
<div id="header-toggle" class="genericon genericon-search">
<a class="screen-reader-text" href="#header-toggle-sidebar"><?php
_e('Search', 'catchadaptive');
?>
</a>
</div>
</div><!-- .wrapper -->
</nav><!-- .nav-primary -->
<?php
}
示例7: sith_fallback_pages
function sith_fallback_pages()
{
$args = array('depth' => 0, 'sort_column' => 'menu_order, post_title', 'menu_class' => '', 'include' => '', 'exclude' => '', 'echo' => false, 'show_home' => true, 'link_before' => '', 'link_after' => '');
$pages = wp_page_menu($args);
$prepend = '<div class="teste">';
$append = '</div>';
$output = $prepend . $pages . $append;
echo $output;
}
示例8: om_primary_menu_fallback
function om_primary_menu_fallback($args)
{
$menu = wp_page_menu(array('echo' => false));
$args['menu_class'] .= ' primary-menu-fallback';
$menu = str_replace('<div class="menu"><ul>', '<div class="menu"><ul class="' . esc_attr($args['menu_class']) . '">', $menu);
if (isset($args) && $args['echo'] == false) {
return $menu;
} else {
echo om_esc_wpcf($menu);
}
}
示例9: joints_main_nav_fallback
function joints_main_nav_fallback() {
wp_page_menu( array(
'show_home' => true,
'menu_class' => '', // Adding custom nav class
'include' => '',
'exclude' => '',
'echo' => true,
'link_before' => '', // Before each link
'link_after' => '' // After each link
) );
}
示例10: mesocolumn_revert_wp_menu_page
function mesocolumn_revert_wp_menu_page($args)
{
global $bp, $bp_active;
$pages_args = array('depth' => 0, 'echo' => false, 'exclude' => '', 'title_li' => '');
$menu = wp_page_menu($pages_args);
$menu = str_replace(array('<div class="menu"><ul>', '</ul></div>'), array('<ul class="sf-menu">', '</ul>'), $menu);
echo $menu;
if ($bp_active == 'true') {
do_action('bp_nav_items');
}
}
示例11: section_nav
public function section_nav($args = array())
{
if (!is_array($args)) {
$args = array();
}
$exclude = EdcMenu::nav_excluded_page_ids();
if (isset($args['exclude']) && is_array($args['exclude'])) {
$exclude = array_merge($args['exlude'], $exclude);
unset($args['exclude']);
}
$topPage = $this->getSectionID();
echo '<h2>' . (0 == $topPage ? '' : get_the_title($topPage)) . '</h2>';
return wp_page_menu(array_merge(array('child_of' => $topPage, 'depth' => 2, 'sort_column' => 'menu_order', 'exclude' => $exclude), $args));
}
示例12: pixopoint_page_menu_shortcode
/**
* [page_menu] shortcode
* @since 0.1
*/
function pixopoint_page_menu_shortcode($atts)
{
// Grabbing parameters and setting default values
extract(shortcode_atts(array('include' => '', 'exclude' => '', 'show_home' => 'true', 'link_before' => '', 'link_after' => ''), $atts));
// Sanitise as comma delimited list of numbers
$include = pixopoint_validate_comma_numeric($include);
$exclude = pixopoint_validate_comma_numeric($exclude);
// True or false settings
if ('false' == $show_home) {
$show_home = 0;
} else {
$show_home = 1;
}
// Sanitise HTML
$link_before = sanitize_title($link_before, '');
$link_after = sanitize_title($link_after, '');
return wp_page_menu('echo=0&include=' . $include . '&exclude=' . $exclude . '&show_home=' . $show_home . '&link_before=' . $link_before . '&link_after=' . $link_after);
}
示例13: widget
/**
* Front-end display of widget.
*
* @see WP_Widget::widget()
*
* @param array $args Widget arguments.
* @param array $instance Saved values from database.
*/
public function widget($args, $instance)
{
echo $args['before_widget'];
?>
<nav id="nav" class="site_nav">
<?php
$args = array('depth' => 0, 'sort_column' => 'menu_order, post_title', 'menu_class' => 'menu', 'include' => '', 'exclude' => '', 'echo' => true, 'show_home' => false, 'post_type' => 'article', 'link_before' => '', 'link_after' => '');
?>
<?php
wp_page_menu($args);
?>
</nav>
<?php
echo $args['after_widget'];
}
示例14: sfhiv_draw_page_navigation
function sfhiv_draw_page_navigation($post_ids, $args = array())
{
extract($args);
if (!is_array($post_ids)) {
$post_ids = array($post_ids);
}
$ids_to_show = array();
?>
<nav><?php
foreach ($post_ids as $ID) {
array_push($ids_to_show, $ID);
if (!isset($show_children) || $show_children) {
$children = get_pages(apply_filters('sfhiv_filter_args', array("parent" => $ID, "hierarchical" => 0, "post_type" => get_post_type($ID))));
foreach ($children as $child) {
array_push($ids_to_show, $child->ID);
}
}
$parents = get_ancestors($ID, get_post_type($ID));
if (!isset($show_parents) || $show_parents) {
foreach ($parents as $parent) {
array_push($ids_to_show, $parent);
}
}
if (!isset($show_siblings) || $show_siblings) {
if (count($parents) > 0) {
$parent_ID = $parents[0];
$siblings = get_pages(apply_filters('sfhiv_filter_args', array("parent" => $parent_ID, "hierarchical" => 0, "post_type" => get_post_type($ID))));
foreach ($siblings as $sibling) {
array_push($ids_to_show, $sibling->ID);
}
}
}
}
wp_page_menu(array_merge($args, array('show_home' => false, 'sort_column' => 'menu_order', 'include' => implode(",", $ids_to_show), 'post_type' => get_post_type($ID), 'walker' => new SFHIV_Post_Type_Walker_Menu())));
?>
</nav><?php
}
示例15: chip_zero_primary_menu
/**
* Chip Menu(s) Callback
*/
function chip_zero_primary_menu()
{
wp_page_menu(array('menu_class' => 'primary-container'));
}