Community Forums › Forums › Archived Forums › Design Tips and Tricks › Remove featured image link
Tagged: featured image, link
- This topic has 7 replies, 4 voices, and was last updated 10 years, 10 months ago by
jstone98.
-
AuthorPosts
-
August 14, 2014 at 3:19 pm #118860
BlueNinja
MemberHello Guys,
I am using beautiful-pro theme for website http://www.mindfitcoaching.co.uk/
I have added this code to enable featured image
add_action( 'genesis_entry_header', 'single_post_featured_image', 15 ); function single_post_featured_image() { if ( ! is_singular( 'post' ) ) return; $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image' ) ) ); printf( '<a href="%s" title="%s">%s</a>', get_permalink(), the_title_attribute( 'echo=0' ), $img ); }This works great and allows me to click on image from home page through to blog page - but the image still has a hyperlink (to same page) once I have clicked through ???
Example here http://www.mindfitcoaching.co.uk/the-elephant-and-the-chain/
http://www.mindfitcoaching.co.ukAugust 14, 2014 at 3:20 pm #118861BlueNinja
MemberSorry clicked too soon!!
So Ideally I would like to remove the hyper-link once clicked into the individual blog post.
Kind Regards
James 🙂
August 18, 2014 at 3:15 am #119495cazwilson
MemberHi @BlueNinja.
You've solved my issue of adding a feature image to a page...thanks!
I thought simply removing the
<a>tags would solve the link problem, but it was just leaving a line of script on the page for me.This is a bit of a hack, but I added style="cursor:default;" to the tag so the cursor doesn't change when you rollover the image (so you don't think it's a link).
So you have:
<a href="%s" title="%s" style="cursor:default;">%s</a>It works for me. I hope it does for you. 🙂
CW
August 18, 2014 at 3:16 am #119496cazwilson
MemberDamn, I'll try again:
<a href="%s" title="%s" style="cursor:default;">%s</a>lol
August 18, 2014 at 3:19 am #119499BlueNinja
MemberHey @cazwilson
Awesome thanks for the reply - I will add this to my code too.
If anyone can suggest another way then please feel free to let us know
Kind Regards
James
August 18, 2014 at 6:10 am #119508Genesis Developer
MemberReplace your code by this
add_action( 'genesis_entry_header', 'single_post_featured_image', 15 ); function single_post_featured_image() { if ( ! is_singular( 'post' ) ) return; $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'post-image' ) ) ); printf( '%s', $img ); }This will remove the hyperlink from single post details page.
August 18, 2014 at 6:14 am #119509January 20, 2015 at 3:43 pm #138131 -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.