Plugin Support
Elvin
(@ejcabquina)
Hi @snecz
I’m not fully sure what you mean.
To clarify: You want to keep the image displayed but remove its link but still have it work as a link?
That’s quite a strange request. But to confirm, is this what you’re asking for? 🙂
Thread Starter
snecz
(@snecz)
Hi @ejcabquina
That’s right as this is better for SEO not to have double links. Link “under” the title is enough.
Plugin Support
Elvin
(@ejcabquina)
We can try making the whole post container a link if that’s fine.
You remove the link for the images with this filter.
add_filter( 'wpsp_disable_image_link', function( $disable, $settings ) {
$disable = true;
return $disable;
}, 10, 2 );
And for the title as well.
add_filter( 'wpsp_disable_title_link', function($output,$settings){
$output = false;
return $output;
});
You then turn the whole post item into a link with this:
We can do that with this snippet.
add_action( 'wpsp_before_header', funnction(){
echo '<a href="'.get_the_ID().'">';
},1);
add_action( 'wpsp_after_content', funnction(){
echo '</a>';
},99);
Or replace wpsp_after_content with wpsp_before_content if you want the image and title only.
Thread Starter
snecz
(@snecz)
Hi @ejcabquina,
Thanks for the answer.
The first filter works fine and removes the link from the image. But there’s something wrong with the second filter and with the snippet.
-
This reply was modified 4 years, 5 months ago by
snecz.