ThemeShaper Forums » Thematic

[closed]

thumbnail link graphic

(3 posts)
  • Started 10 years ago by lastraw
  • Latest reply from lastraw
  • This topic is not resolved
  1. Hi everyone,

    I need to put an arrow-type .png that will display on top of the thumbnails to make them more obviously clickable. I think I would do that in the functions, by adding a style that would have the arrow as a background floating on top of the thumbnail?

    Here is what I have in the function.php file

    <?php
    // ads to each thumbnail a link to the permalink
    add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
    function my_post_image_html( $html, $post_id, $post_image_id ) {
    	$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '" rel="nofollow">' . $html . '</a>';
    	return $html;
    }
    function thumbnail_caption($html, $post_id, $post_thumbnail_id, $size, $attr)
    {
      $attachment =& get_post($post_thumbnail_id);
    
      // post_title => image title
      // post_excerpt => image caption
      // post_content => image description
    
      if ($attachment->post_excerpt || $attachment->post_content) {
        $html .= '<p class="thumbcaption">';
        if ($attachment->post_excerpt) {
          $html .= '<span class="captitle">'.$attachment->post_excerpt.'</span> ';
        }
        $html .= $attachment->post_content.'</p>';
      }
    
    	return $html;
    };
    add_action('post_thumbnail_html', 'thumbnail_caption', null, 5);
    ?><?php
    // ads to each thumbnail a link to the permalink
    add_filter( 'post_thumbnail_html', 'my_post_image_html', 10, 3 );
    function my_post_image_html( $html, $post_id, $post_image_id ) {
    	$html = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_post_field( 'post_title', $post_id ) ) . '" rel="nofollow">' . $html . '</a>';
    	return $html;
    }
    function thumbnail_caption($html, $post_id, $post_thumbnail_id, $size, $attr)
    {
      $attachment =& get_post($post_thumbnail_id);
    
      // post_title => image title
      // post_excerpt => image caption
      // post_content => image description
    
      if ($attachment->post_excerpt || $attachment->post_content) {
        $html .= '<p class="thumbcaption">';
        if ($attachment->post_excerpt) {
          $html .= '<span class="captitle">'.$attachment->post_excerpt.'</span> ';
        }
        $html .= $attachment->post_content.'</p>';
      }
    
    	return $html;
    };
    add_action('post_thumbnail_html', 'thumbnail_caption', null, 5);
    ?>

    Anyone have any advice on how to do that?

    Thanks!

    Leslie

    Posted 10 years ago #
  2. assuming these functions are being applied to a custom page template with a custom loop, you could add a containing div to the div within the loop where the thumbnail is assigned.

    If this is being applied to a default thematic page, index.php, category.php...ect, you'd have to create a page-specific conditional filter that adds the containing div to the_content.

    I hope this gives some direction. If I can look at the site I could provide more specific code-related ideas.

    Posted 10 years ago #
  3. Thanks tarpontech,

    For this particular site, they want the graphic on all the thumbnails. I have a mental block how to add a containing div to the function posted above.

    L

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.