php - Trying to strip li tags from get_archives_link -


i'm creating wordpress theme , using get_archives_link list archive info.

get_archives_link default displays archive list wrapped around <li></li> tags below.

<li><a href='http://localhost/blog/?m=201505'>may 2015</a></li> 

but displayed href instead following example:

<a href='http://localhost/blog/?m=201505' class="list-group-item">may 2015</a> 

any ideas on how can around this?

thanks!

you can use preg_replace achieve this, see example below :-

$anchorwithli = "<li><a href='http://localhost/blog/?m=201505'>may 2015</a></li>"; echo preg_replace('#<li>(<a)(.*)</li>#i', '$1 class="list-group-item" $2', $anchorwithli); 

output:

<a class="list-group-item"  href='http://localhost/blog/?m=201505'>may 2015</a> 

Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -