- This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
In wordpress I have the following code:
<div class="blog-elegant-right">
<?php
// 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( '->', '→', yiw_get_option('blog_read_more_text') ) );
}
?>
</div>
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.
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:
<a href="<?php echo get_permalink(); ?>"><img src="img/pic.jpg" alt="image" /></a>
<code></code>
I hope you get the idea.