Skip to content

Instantly share code, notes, and snippets.

@dimadin
Last active August 29, 2015 14:02
Show Gist options
  • Save dimadin/e4445d21002ccdade530 to your computer and use it in GitHub Desktop.
Save dimadin/e4445d21002ccdade530 to your computer and use it in GitHub Desktop.
WP Links Widgets Customizing
<?php
/**
* Replace <ul> from blogroll widget with <div>.
*/
function md_replace_ul_blogroll( $output ) {
$output = str_replace( "<ul class='xoxo blogroll'>", "<div>", $output );
$output = str_replace( "</ul>", "</div>", $output );
return $output;
}
add_filter( 'wp_list_bookmarks', 'md_replace_ul_blogroll' );
/**
* Replace <li> from blogroll widget with <span>.
*/
function md_replace_li_blogroll( $args ) {
$args['before'] = '<span>';
$args['after'] = '</span>';
return $args;
}
add_filter( 'widget_links_args', 'md_replace_li_blogroll' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment