WordPress Snippets at WPcustoms

Add icon to blogroll widget links

This snippet customizes the html output of the blogroll links widget. In this example we add an icon after the list tag so it appears left to every link


/**
 * Snippet Name: Add icon to blogroll widget links
 * Snippet URL: https://wpcustoms.net/snippets/add-icon-blogroll-widget-links/
 */
  function wpc_modify_blogroll_list( $args )
{
    $li_start = isset ( $args['before'] ) ? $args['before'] : '
  • '; $args['before'] = $li_start . ''; return $args; } add_filter( 'widget_links_args', 'wpc_modify_blogroll_list' );