PHP将同级页面显示为一组图像

PHP将同级页面显示为一组图像,php,html,css,wordpress,Php,Html,Css,Wordpress,我试图自定义以下代码,使其显示当前页面的所有同级页面,但不是将它们作为标题输出,而是将它们作为bulletpoints(样式为bulletpoints的图像,'images/bulletpoint.gif')输出。我有以下代码将它们显示为名称,但似乎无法自定义它们以显示为图像。有什么想法吗 非常感谢 <ul class="subnav_right"> <?php global $post; $current_page_parent = ( $post->post_pare

我试图自定义以下代码,使其显示当前页面的所有同级页面,但不是将它们作为标题输出,而是将它们作为bulletpoints(样式为bulletpoints的图像,'images/bulletpoint.gif')输出。我有以下代码将它们显示为名称,但似乎无法自定义它们以显示为图像。有什么想法吗

非常感谢

<ul class="subnav_right">
<?php
global $post;
$current_page_parent = ( $post->post_parent ? $post->post_parent : $post->ID );

wp_list_pages( array(
     'title_li' => '',
     'child_of' => $current_page_parent,
     'depth' => '1' )
);
?>
</ul>

您可以使用walker进行自定义。我已经使用walker进行了自定义。检查以下代码:

学步班:

class Custom_Walker extends Walker_Page {

    function start_el( &$output, $page, $depth, $args, $current_page = 0 ) {
        if ( $depth )
            $indent = str_repeat("\t", $depth);
        else
            $indent = '';
            extract($args, EXTR_SKIP);
            $css_class = array('page_item', 'page-item-'.$page->ID);
        if ( !empty($current_page) ) {
            $_current_page = get_post( $current_page );
            if ( in_array( $page->ID, $_current_page->ancestors ) )
                $css_class[] = 'current_page_ancestor';
            if ( $page->ID == $current_page )
                $css_class[] = 'current_page_item';
            elseif ( $_current_page && $page->ID == $_current_page->post_parent )
                $css_class[] = 'current_page_parent';
        }
        elseif ( $page->ID == get_option('page_for_posts') ) {
            $css_class[] = 'current_page_parent';
        }

        $css_class = implode( ' ', apply_filters( 'page_css_class', $css_class, $page, $depth, $args, $current_page ) );
        $icon_class = get_post_meta($page->ID, 'icon_class', true); //Retrieve stored icon class from post meta

        $output .= $indent . '<li class="' . $css_class . '">';
            $output .= '<a href="' . get_permalink($page->ID) . '">' . $link_before;

                if($icon_class){ //Test if $icon_class exists
                    $output .= '<span class="' . $icon_class . '"></span>'; //If it exists output a span with the $icon_class attached to it
                }


            if($depth!=0){
                $output .= apply_filters( 'the_title', '', $page->ID );
            }else {
                 $output .= apply_filters( 'the_title', $page->post_title, $page->ID );
            }
            $output .= $link_after . '</a>';

        if ( !empty($show_date) ) {
            if ( 'modified' == $show_date )
                $time = $page->post_modified;
                else
                $time = $page->post_date;
                $output .= " " . mysql2date($date_format, $time);
        }
    }
}

您正在上载全部同级的图像或项目符号点吗?只希望每个同级都列为项目符号点图像,无文本。所以每个兄弟姐妹都有一张图片,谢谢你-那仍然输出页面标题吗?而不是bulletpoint图像?在哪里添加代码以显示图像?在functions.php中是。如果有帮助,请接受答案是,但它仍然输出相同的名称?我应该把图片链接放在哪里?把类放到你正在使用的wp_列表_页面中,然后检查一次。因为它在这里工作得很好,不,它仍然输出名称,而不是图像。在页面中,我有
    这是否正确?
    wp_list_pages( array( 'title_li' => '',
         'child_of' => $current_page_parent,
         'depth' => '1',
          'walker' => new Custom_Walker())
    );