WordPress: Add Title to IMG tag using Get The Image plugin

This image is a screenshot from Get The Image plugin.

This image is a screenshot from Get The Image plugin.

Get The Image plugin from Justin Tadlock is awesome, a script that can grab an image by custom field input, WordPress’ featured image, post attachment, or extracting it from the post’s content.

Recently, someone asked about how to add Title to IMG tag. We know ALT attributes in IMG tag, but IMG tag also support Title attributes as well. These two attributes supposed to describe the image in words and impact image search rankings. ALT attribute should describe what the image is about, while Title should follow the rules of the regular title.

Get The Image only have ALT attribute, we are adding Title attribute by changing following code
1. Open get-the-image.php with Text Editor. I’m using Text Wrangler on Mac
2. Find following code, it’s in line 459-460 on Text Wrangler. Change it from

/* Add the image attributes to the <img /> element. */
	$html = '<img src="' . $image['src'] . '" alt="' . esc_attr( strip_tags( $image_alt ) ) . '" class="' . esc_attr( $class ) . '"' . $width . $height . ' />';

to

/* Add the image attributes to the <img /> element. */
    $html = '<img src="' . $image['src'] . '" alt="' . esc_attr( strip_tags( $image_alt ) ) . '" title="' . esc_attr( apply_filters( 'the_title', get_post_field( 'post_title', $post_id ) ) ) . '" class="' . esc_attr( $class ) . '"' . $width . $height . ' />';

I had new domain alias setup in Google Apps before I encountered this error when was trying to send email to new domain alias

550-Please turn on SMTP Authentication in your mail client, or login to the
550-IMAP/POP3 server before sending your message

The error happened because DNS propagation, wait for 24 hours for server to resolve.

Mac App Store: “You Have Updates Available for Other Accounts”

This what was happening when I tried to update Coda 2 on Mac

I have only one Apple ID, when I clicked the Purchases tab, the button next to Coda 2 showed Update. I clicked it and got a dialog, “You have updates available for other accounts.”

This is how to fix it
1. Repair Disk Permission.
Launch Disk Utility (/Applications/Utilities), select your startup disk and click the Repair Disk Permissions button near the bottom of the window. In a couple of minutes your permissions will be set right.
Source: Macworld
2. Enable Spotlight Indexing
There are two solutions in NGPixel blog post, solution no 2, that is using terminal command is working for me

  • Open a Terminal window.
  • Type the following command: sudo mdutil -i on /
  • You are required to enter your Mac OSX login password, if you have setup Mac OSX login. A message saying “Indexing enabled.” should appear after a few seconds.
  • Close the Terminal window and the Spotlight indexing should now start automatically. (Again, a dot will appear inside the Spotlight icon during the indexing process)
  • Wait for it to finish and then launch the Mac App Store<

Note: If Spotlight hasn’t started to index, please try to restart your Mac
Source: NGPixel

WordPress: How to Display Date and Time with User-preferred Formatting

wpdatetimesettings
We set Date Format and Time Format in WordPress General Setting and we want to display that date on WordPress template. The Date Format and the Time Format settings allow us to set Date and Time to any format we wants, it also easier to use with localization. Use following code in WordPress template
Date

<?php the_time(get_option('date_format')); ?>

Time

<?php the_time(get_option('time_format')); ?>