Hello guys, I'm trying to insert link to my thumbnail images, but I'm stuck, can someone please help me? My code is: <?php if(has_post_thumbnail()) : the_post_thumbnail( 'full' ); else : ?> PHP: Thank you for help! Kind regards
After reading this url: https://codex.wordpress.org/Function_Reference/the_post_thumbnail I notice this solution: <?php if ( has_post_thumbnail() ) : ?> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"> <?php the_post_thumbnail(); ?> </a> <?php endif; ?> PHP: But my php knowledge is very very poor, and I dont know how can I edit my code: <?php if(has_post_thumbnail()) : the_post_thumbnail( 'full' ); else : ?> PHP: As I can see, I need to put the_post_thumbnail( 'full' ); inside the a tag, but how? Any ideas? Thanks!
I think you should be able to just replace the code you had, with the one you pasted. That should do the trick.
Hey PoPSiCLe, thank you for your reply But where I put the else? This is my full code: <?php if(has_post_thumbnail()) : the_post_thumbnail( 'full' ); else : ?> <img class="attachment-full wp-post-image" src="<?php bloginfo('template_url'); ?>/images/sample450.jpg" /> <?php endif; ?> PHP: Thanks once again