The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Adding permalink to thumbnail

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #180211

    In wordpress I have the following code:

     <div class="blog-elegant-right">
                                // thumbnail
                                if ( $has_thumbnail ) {
                                    echo apply_filters( 'yiw-loop-blog-elegant-thumbnail', get_the_post_thumbnail( get_the_ID(), 'blog_elegant' ) );
                                // content
                                add_filter( 'excerpt_more', create_function( '$more', 'return "<br /><br /><a class=\"more-link\" href=\"'. get_permalink( get_the_ID() ) . '\">' . yiw_get_option('blog_read_more_text') . '</a>";' ) );
                                if( !is_single() OR get_post_type() == 'bl_testimonials' ) {
                                        the_excerpt( str_replace( '->', '&rarr;', yiw_get_option('blog_read_more_text') ) ); 

    Which gets the post thumbnail and excerpt. I didn’t build this by the way. Don’t know much about php.

    I need the thumbnail to link to the post and I’d like a read more at the end of the excerpt.

    How do I do this?


    You want to look further into the theme.

    Somewhere, you’ll find the HTML that has referenced yiw-loop-blog-elegant-thumbnail – just do a ctrl-f (or in OSX command-f) for it in each file, you’ll get it eventually.

    [email protected]

    This is all you need to do:
    Within the loop you can just use this code <?php echo get_permalink(); ?>

    This code gets the link for the current post.

    And you can use that code to link thumbnails to the post like this:
    &lt;a href="&lt;?php echo get_permalink(); ?&gt;"&gt;&lt;img src="img/pic.jpg" alt="image" /&gt;&lt;/a&gt;

    I hope you get the idea.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Back End’ is closed to new topics and replies.