wp_list_pages example


        $title = apply_filters( 'widget_title', $title$instance$this->id_base );

        $sortby  = empty( $instance['sortby'] ) ? 'menu_order' : $instance['sortby'];
        $exclude = empty( $instance['exclude'] ) ? '' : $instance['exclude'];

        if ( 'menu_order' === $sortby ) {
            $sortby = 'menu_order, post_title';
        }

        $output = wp_list_pages(
            /** * Filters the arguments for the Pages widget. * * @since 2.8.0 * @since 4.9.0 Added the `$instance` parameter. * * @see wp_list_pages() * * @param array $args An array of arguments to retrieve the pages list. * @param array $instance Array of settings for the current widget. */
            
if ( ! empty( $list_args['exclude'] ) ) {
                $list_args['exclude'] .= ',';
            } else {
                $list_args['exclude'] = '';
            }
            $list_args['exclude'] .= get_option( 'page_on_front' );
        }
    }

    $list_args['echo']     = false;
    $list_args['title_li'] = '';
    $menu                 .= wp_list_pages( $list_args );

    $container = sanitize_text_field( $args['container'] );

    // Fallback in case `wp_nav_menu()` was called without a container.     if ( empty( $container ) ) {
        $container = 'div';
    }

    if ( $menu ) {

        // wp_nav_menu() doesn't set before and after.
sprintf( '<a href="%1$s/">%2$s</a>', get_bloginfo( 'url' )get_bloginfo( 'name' ) )
                    );
                ?> </p> <?php endif; ?> </li> <?php endif; ?> </ul> <ul role="navigation"> <?php wp_list_pages( 'title_li=<h2>' . __( 'Pages' ) . '</h2>' ); ?> <li><h2><?php _e( 'Archives' ); ?></h2> <ul> <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?> </ul> </li> <?php                 wp_list_categories(
                    array(
                        'show_count' => 1,
                        
Home | Imprint | This part of the site doesn't use cookies.