I am showing groups with this particular codes. Normally there's not a problem.

$categories = wp_list_categories('current_category=1&hide_empty=0&title_li=&echo=0&link_before=<span>&link_after=</span>');
$categories = preg_replace('/title=\"(.*?)\"/','',$categories);
echo $categories;

But i wish to wrap current category's text into <span> tag for showing current category image.

In a nutshell: <a href="#">Home</a> to <a href="#"><span>Home</span></a>.

The way i can perform it with PHP?


Replace your next type of code with this particular:

$categories = preg_replace(

And it'll still take away the title tags in addition to add the <span></span> inside each one of the <a> tags.

All of this?:

<?php $categories = get_categories(); foreach ($categories as $cat) {echo '<a href="'.get_option('home').'/'.get_option('category_base').'/'.$cat->category_nicename.'/"><span>'.$cat->cat_name.'</span></a>'; } ?>