ThemeShaper Forums » Power Blog

[closed]

Post thumnails wont wrap text

(3 posts)
  • Started 4 years ago by mrsmarshah
  • Latest reply from mrsmarshah
  1. mrsmarshah
    Member

    I was searching the forum for post thumbnail help and I found this code that I have displayed below. The problem I am having is that the text appears above the title. I did find a topic on this but it didn't fix the problem. (http://forums.themeshaper.com/topic/inserting-post-thumbnails-in-thematic#post-10582)

    What I would like is for the thumbnail to wrap the text when aligned left. I would also like to know how to make the thumbnail clickable and link to the full length post.

    // Thumbnails
    add_theme_support('post-thumbnails');
    function my_post_title($title) {
    if (is_category()) {
    return get_the_post_thumbnail(NULL, 'thumbnail') . $title;
    } else {
    return $title;
    }
    }
    add_filter('thematic_postheader_posttitle', 'my_post_title');

    Posted 4 years ago #
  2. mrsmarshah
    Member

    Edit: Thumbnail is now linked to the full post. Alignment is still un resolved. Here is the updated code:

    // Thumbnails
    add_theme_support('post-thumbnails');
    function my_post_title($title) {
        if (is_category()) {
            return '<a class="post-thumbnail-link" href="'.get_permalink().'">'.get_the_post_thumbnail(NULL, 'thumbnail').'</a>' . $title;
        } else {
            return $title;
        }
    }
    add_filter('thematic_postheader_posttitle', 'my_post_title');
    Posted 4 years ago #
  3. mrsmarshah
    Member

    I got help over at the WordPress forums. Here is the final code for anyone who is having the same issue:

    // Thumbnails
    add_theme_support('post-thumbnails');
    function my_post_title($posttitle) {
    if (is_single() || is_page()) {
    $posttitle = '<h1 class="entry-title">' . get_the_title() . "</h1>\n";
    } elseif (is_404()) {
    $posttitle = '<h1 class="entry-title">' . __('Not Found', 'thematic') . "</h1>\n";
    } elseif (is_category()) {
    $posttitle = '<h2 class="entry-title">';
    $posttitle .= ''.get_the_post_thumbnail(NULL, 'thumbnail').'';
    $posttitle .= '<a href="';
    $posttitle .= get_permalink();
    $posttitle .= '" title="';
    $posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0');
    $posttitle .= '" rel="bookmark">';
    $posttitle .= get_the_title();
    $posttitle .= "</h2>\n";
    } else {
    $posttitle = '<h2 class="entry-title"><a href="';
    $posttitle .= get_permalink();
    $posttitle .= '" title="';
    $posttitle .= __('Permalink to ', 'thematic') . the_title_attribute('echo=0');
    $posttitle .= '" rel="bookmark">';
    $posttitle .= get_the_title();
    $posttitle .= "</h2>\n";
    }

    return $posttitle;
    }
    add_filter('thematic_postheader_posttitle', 'my_post_title');

    http://wordpress.org/support/topic/post-thumnail-in-thematic-wont-wrap-text?replies=8#post-1684633

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.