WordPress.org

Ready to get started?Download WordPress

Forums

Bookmarks Template Issue. Space between image and name. (2 posts)

  1. lachie_h
    Member
    Posted 2 years ago #

    I've got a bit of a pickle with the bookmarks widget and the wp_list_bookmarks function.

    I've added a blogroll to my site using a dynamic sidebar and the default links widget. This is all fine, except because I want to use images in the blogroll, the function creates a space between the image and the title.

    For most people, this is fine, however I have the image padding set using css and the title of the link comes up as ' linkname' (notice the leading space?). Because I have the links underlined, it leaves a noticably uneven space at the beginning of the link.
    Like this:  linkname. It looks ugly.

    Now, I have fixed it, but the problem that I have is that the only way I was able to fix it was by editing wp_includes/bookmark_template.php

    The code in question starts at line 103.

    if ( $bookmark->link_image != null && $show_images ) {
    	if ( strpos($bookmark->link_image, 'http') === 0 )
    		$output .= "<img src=\"$bookmark->link_image\" $alt $title />";
    	else // If it's a relative path
    		$output .= "<img src=\"" . get_option('siteurl') . "$bookmark->link_image\" $alt $title />";
    
    	if ( $show_name )
    		$output .= " $name";
    } else {
    	$output .= $name;
    }

    I had to change line 110 from:
    $output .= " $name";
    to
    $output .= "$name";
    My question is, should there be a variable to turn this on/off and is there a way to override this so that it doesn't get reverted during a core update?

  2. Marventus
    Member
    Posted 2 years ago #

    Hi,

    I would advice very strongly against modifying core files. Other than that, the function in question does not have any filters or hooks you can use to modify the output (none that I can see, at least).
    I think your best bet would to submit this as a ticket in Trac and in the meantime implement a temporary CSS hack by removing the text-decoration to your bookmarks.
    Cheers!

Topic Closed

This topic has been closed to new replies.

About this Topic