ying
(@yingscarlett)
Hi there,
What do you mean by blogger share link? The link attached to the text blogger is a 404 page.
Let me know π
Thread Starter
r3ndy
(@r3ndy)
@yingscarlett
There was an error in providing the link, the link was updated..
-
This reply was modified 1 year, 1 month ago by
r3ndy.
Hi there,
There isnβt a specific filter for that in GeneratePress, but you might be able to use the post_thumbnail_html filter provided by WordPress.
https://developer.wordpress.org/reference/hooks/post_thumbnail_html/
Thread Starter
r3ndy
(@r3ndy)
@alvindcaesar
The suggestions you gave didn’t work or maybe I did something wrong. Please help me for the proper code snippet to display blogger image link to wordpress featured image without any plugin help.
ying
(@yingscarlett)
Your link was to a logo, is that the link you want to added to your featured image on the blog page?
Thread Starter
r3ndy
(@r3ndy)
@yingscarlett
Yes that’s right, I want to add an existing link image to the featured image on the blog page.
For example, Plugin: Featured Image with URL, but unfortunately it doesn’t have width and height settings for each image page.
-
This reply was modified 1 year, 1 month ago by
r3ndy.
ying
(@yingscarlett)
add_filter( 'generate_featured_image_output', 'change_featured_image_link_to_google', 10, 1 );
function change_featured_image_link_to_google( $output ) {
// Use regex or string replacement to swap the URL in the <a> tag
$output = preg_replace(
'/<a href="[^"]*">/',
'<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIKmvbEue2-cFrMwzRzJd7hixyAkJwIkIpYXVRUsy84Ycybk_PIo3bjHbqVUCvGEbGYfsM5h0mMvfsgTBdu4zFb5RQwxp8wrsDfhktWPanX3ObjoFY69VS_3fWn2y0QeEJrRmQyFaZMA7e1A8dSBZe7M0nMyln-JF1Vj6KBczjyXiPBIL4gsk4ZQ03j1k/s200/malwarebytes-logo.webp">',
$output
);
return $output;
}
Try the above PHP code.
Adding PHP: https://docs.generatepress.com/article/adding-php/
Thread Starter
r3ndy
(@r3ndy)
@yingscarlett
<font style=”vertical-align: inherit;”><font style=”vertical-align: inherit;”>Saya telah memasang potongan kode Anda di tema anak, tetapi tidak berfungsi. Anda dapat meninjau situs saya lagi (r3ndy[dot]top). Dan saya tidak lupa menghapus cache di situs saya.</font></font>
Screenshot: https://prnt.sc/4jlNR1FG5Tpd
-
This reply was modified 1 year, 1 month ago by
r3ndy.
Thread Starter
r3ndy
(@r3ndy)
@yingscarlett
I have installed your code snippet in a child theme, but it doesn’t work. You can review my site again (r3ndy[dot]top). And I don’t forget to clear the cache on my site.
Screenshot:Β https://prnt.sc/4jlNR1FG5Tpd
ying
(@yingscarlett)
I’ve tested the code on my fresh install and it worked.
Can you try using a plugin like code snippets? https://en-ca.wordpress.org/plugins/code-snippets/
Thread Starter
r3ndy
(@r3ndy)
@yingscarlett
Sorry for the late reply, the code you provided works.