• Resolved pixelatedbit

    (@pixelatedbit)


    Great plugin, but I would like to remove the title text that appears when you hover over a thumbnail image. I noticed there is a custom css / styles box at the bottom of the widget control panel, so if you could give me the css needed to remove this that would be great 🙂

    Thanks,
    PixelatedBit

    https://wordpress.org/plugins/posts-in-sidebar/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter pixelatedbit

    (@pixelatedbit)

    Also if you can tell me how to shorten the title length and if possible increase the title font size that would be great to 🙂

    Thanks,

    Plugin Author Aldo Latino

    (@aldolat)

    Hi,
    sorry for the delay!

    1. Removing title attribute and shortening titles

    About your questions, you can use Javascript to strip the title attribute off from the HTML and to shorten the titles.
    To do so, open the functions.php of your current theme and paste these lines at the end of the file (only make sure to paste before a possible PHP ending tag ?> at the end of the file):

    function posts_in_sidebar_hacks() {
    	wp_enqueue_script( 'remove-title-from-a', get_template_directory_uri() . '/js/posts-in-sidebar-hacks.js', array( 'jquery' ), false, true );
    }
    add_action( 'wp_enqueue_scripts', 'posts_in_sidebar_hacks' );

    Then, create a text file in your text editor and paste these lines:

    jQuery(document).ready(function(){
    	// Remove the title attribute from all links with "pis-thumbnail-link" class.
    	jQuery('a.pis-thumbnail-link').removeAttr("title");
    	// Shorten all links with "pis-title-link" class to 9 characters if they are longer than 10 characters
    	jQuery('a.pis-title-link').each(function(){
    		var str = jQuery(this).text();
    		str = str.trim(str);
    		if (str.length > 10) {
    			jQuery(this).text(str.substr(0, 9));
    			jQuery(this).append('…');
    		}
    	});
    });

    Change 10 and 9 according to your needs.

    Save the file as posts-in-sidebar-hacks.js in the root folder of your current theme.

    Upload your modified files to your server and test the result.

    Let me know.

    2. Increasing font of titles

    In this case I need to take a look at the HTML of your site. Could you give me the URL?

    Bye.

    Plugin Author Aldo Latino

    (@aldolat)

    Hi PixelatedBit,
    have you tried my tips?

    Thread Starter pixelatedbit

    (@pixelatedbit)

    Thanks, sorry for the delay, I was without internet for a while.

    Your tips worked great, thanks 🙂

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove Title Text on Image Hover’ is closed to new replies.