-
AuthorPosts
-
January 20, 2015 at 1:46 pm #187102
Hi,
How do I display title and alt text metadata for featured images on mouseover?
January 21, 2015 at 12:36 am #187386Hi,
Thanks for writing in! To assist you with this issue, we’ll first need you to provide us with your URL as stated on the forum entrance page. This is to ensure that we can provide you with a tailored answer to your situation. Once you have provided us with your URL, we will be happy to assist you with everything.
January 22, 2015 at 2:25 pm #189354Hi, my URL is: http://www.dave-dewitt.com/
The issue I’m writing in about seems to be a WordPress issue, where the meta title information for featured images is technically there but does not appear on mouse-over unlike non-featured images which do show title meta on mouse-over. Can you provide a code solution for this?
January 23, 2015 at 9:10 am #189959Hi there,
Upon checking, the title of images showing just fine for me on mouse hover (see: http://prntscr.com/5w1a9m). Would you mind confirming again or point us to the specific image where you want to show the title on mouse hover?
Thanks!
January 23, 2015 at 2:08 pm #190256Thanks for the reply. I’d like the title of a featured image to show on mouseover inside of a post/portfolio item. For instance when I mouseover the featured image in this post: http://www.dave-dewitt.com/2015/01/18/im-a-novelist-too/ nothing appears even though title meta data exists. Compare this to non-featured images I have in the body of my posts which do show title metadata on mouseover and you’ll see what I mean. Is this a theme X default or WordPress issue? In any case, it doesn’t make sense that a featured image wouldn’t show this data on mouseover as every other image on my site does.
January 24, 2015 at 3:02 pm #190865Hi there,
Meta titles that appears when hovered are only applicable for image with links. Your inserted image is from library in which you chosen not to have a link. The meta title will be added along with the link when inserted, and you can modify those meta titles through that link when viewed on text mode.
Thanks!
January 25, 2015 at 11:19 pm #191448Thanks for the reply, but your response doesn’t make sense. You can’t set a link for a featured image in WordPress. See screenshot with greyed-out non-editable URL field: https://www.dropbox.com/s/gmfk6017xdb25w7/Screen%20Shot%202015-01-25%20at%2010.14.48%20PM.png?dl=0
January 26, 2015 at 10:31 am #191909Hi there,
We’re sorry for the confusion!
This is the default behaviour that the link of featured image will be disabled on single post page. However, if you wish to add the link in single post page too, you can add following code in your child theme’s functions.php file:
if ( ! function_exists( 'x_featured_image' ) ) : function x_featured_image( $cropped = '' ) { $stack = x_get_stack(); $fullwidth = ( in_array( 'x-full-width-active', get_body_class() ) ) ? true : false; if ( has_post_thumbnail() ) { if ( $cropped == 'cropped' ) { if ( $fullwidth ) { $thumb = get_the_post_thumbnail( NULL, 'entry-cropped-fullwidth', NULL ); } else { $thumb = get_the_post_thumbnail( NULL, 'entry-cropped', NULL ); } } else { if ( $fullwidth ) { $thumb = get_the_post_thumbnail( NULL, 'entry-fullwidth', NULL ); } else { $thumb = get_the_post_thumbnail( NULL, 'entry', NULL ); } } switch ( is_singular() ) { case true: printf( '<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>', esc_url( get_permalink() ), esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ), $thumb ); break; case false: printf( '<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>', esc_url( get_permalink() ), esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ), $thumb ); break; } } } endif;
Hope this helps. 🙂
Thank you.
January 26, 2015 at 3:40 pm #192137Hi again,
Actually, all I want to do is add the title meta data to a featured image. Is there a way to add title meta data (which will appear on mouseover) to a featured image within a post without also making it a link?
January 27, 2015 at 4:26 am #192538Hi there,
Please change your code to :
if ( ! function_exists( 'x_featured_image' ) ) : function x_featured_image( $cropped = '' ) { $stack = x_get_stack(); $fullwidth = ( in_array( 'x-full-width-active', get_body_class() ) ) ? true : false; if ( has_post_thumbnail() ) { if ( $cropped == 'cropped' ) { if ( $fullwidth ) { $thumb = get_the_post_thumbnail( NULL, 'entry-cropped-fullwidth', NULL ); } else { $thumb = get_the_post_thumbnail( NULL, 'entry-cropped', NULL ); } } else { if ( $fullwidth ) { $thumb = get_the_post_thumbnail( NULL, 'entry-fullwidth', NULL ); } else { $thumb = get_the_post_thumbnail( NULL, 'entry', NULL ); } } switch ( is_singular() ) { case true: printf( '<a class="entry-thumb" title="%2$s">%3$s</a>', esc_url( get_permalink() ), esc_attr( sprintf( __( '"%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ), $thumb ); break; case false: printf( '<a href="%1$s" class="entry-thumb" title="%2$s">%3$s</a>', esc_url( get_permalink() ), esc_attr( sprintf( __( 'Permalink to: "%s"', '__x__' ), the_title_attribute( 'echo=0' ) ) ), $thumb ); break; } } } endif;
Hope it helps.
-
AuthorPosts