titles with thumbnails
-
I am using the Spun theme ..and trying to get the title to hover over the thumbnail even if there is a thumbnail. Currently it only shows when there is no image or thumb.
I am not a javascript or css expert although I can get by. I’ve added this as per a different post I found in the forums:
$thumb = get_the_post_thumbnail( $post->ID, 'post-thumbnail', array( 'title' => esc_attr( get_the_title() ) ) ) . '<span class="no-thumbnail">' . get_the_title() . '</span>';
to the content-home.php file
and it’s showing the titles underneath the circles.
to me it makes logical sense that the code is doing this:
if no thumbnails
put title
if thumbnail
put thumbnail
endifi’m not sure but to me it makes more send to edit something in this part of the code as well:
if ( $first_attachment ) { foreach ( $first_attachment as $attachment ) { $thumb = wp_get_attachment_image( $attachment->ID, 'post-thumbnail', false, array( 'title' => esc_attr( get_the_title() ) ) ); } } else { $thumb = '<span class="no-thumbnail">' . get_the_title() . '</span>'; $postclass = 'no-thumbnail'; } } ?> <article id="post-<?php the_ID(); ?>" <?php post_class( $postclass ); ?>> <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php echo $thumb; ?></a> </article><!-- #post-<?php the_ID(); ?> -->
or maybe I’m just missing something altogether.
in the other thread there was talk of doing what i’ve done and then just changing the css code..but to me the css code is already done..since it’s being used when there is NO thumbnail….so i would think logically it’s just the if/then statement that needs to include the title OR not exclude it when there is a thumb.
i hope this all makes sense
site: https://greenboutique.ca
- The topic ‘titles with thumbnails’ is closed to new replies.