Hi,
ich suche eine Möglichkeit wie ich die Funktion wp_list_categories() so erweitern kann, dass vor jeder Kategorie noch ein Zeichen ausgegeben wird.
Aktuell ist es ja (bei einer Liste) so:
<ul>
<li> [link]</li>
</ul>
Bei mir soll es z.B. so aussehen:
<ul>
<li>» [link]</li>
</ul>
Habe schon versucht das entsprechende Zeichen direkt in der category-template.php einzubauen, aber es wird nicht ausgegeben!? Sieht so aus bei mir:
function wp_list_categories( $args = '' ) {
$defaults = array(
'show_option_all' => '', 'orderby' => 'name',
'order' => 'ASC', 'show_last_update' => 0,
'style' => 'list', 'show_count' => 0,
'hide_empty' => 1, 'use_desc_for_title' => 1,
'child_of' => 0, 'feed' => '', 'feed_type' => '',
'feed_image' => '', 'exclude' => '', 'exclude_tree' => '', 'current_category' => 0,
'hierarchical' => true, 'title_li' => __( 'Categories' ),
'echo' => 1, 'depth' => 0
);
$r = wp_parse_args( $args, $defaults );
if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
$r['pad_counts'] = true;
}
if ( isset( $r['show_date'] ) ) {
$r['include_last_update_time'] = $r['show_date'];
}
if ( true == $r['hierarchical'] ) {
$r['exclude_tree'] = $r['exclude'];
$r['exclude'] = '';
}
extract( $r );
$categories = get_categories( $r );
$output = '';
if ( $title_li && 'list' == $style )
$output = '<li class="categories">• ' . $r['title_li'] . '<ul>';
if ( empty( $categories ) ) {
if ( 'list' == $style )
$output .= '<li>' . __( "No categories" ) . '</li>';
else
$output .= __( "No categories" );
} else {
global $wp_query;
if( !empty( $show_option_all ) )
if ( 'list' == $style )
$output .= '<li>• <a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a></li>';
else
$output .= '• <a href="' . get_bloginfo( 'url' ) . '">' . $show_option_all . '</a>';
if ( empty( $r['current_category'] ) && is_category() )
$r['current_category'] = $wp_query->get_queried_object_id();
if ( $hierarchical )
$depth = $r['depth'];
else
$depth = -1; // Flat.
$output .= walk_category_tree( $categories, $depth, $r );
}
if ( $title_li && 'list' == $style )
$output .= '</ul></li>';
$output = apply_filters( 'wp_list_categories', $output );
if ( $echo )
echo $output;
else
return $output;
}
Alles anzeigen
In dem Beispiel habe ich • verwendet.
Achtung: Ich möchte es nicht per CSS (list-style) machen.