Archived topic
how to make the social share on all pages?
13 replies · Started by eran on October 31, 2022
Hi,
I use this code for my social share buttons after the content:
<?php
$wplogoutURL = urlencode(get_the_permalink());
$wplogoutTitle = urlencode(get_the_title());
$wplogoutImage= urlencode(get_the_post_thumbnail_url(get_the_ID(), 'full'));
?>
It worked when I displayed it on all posts.
But when I set it to all pages, it doesn't work.
Any idea why?
Hi there,
how have you added the code ?
Through Hook element
And what are Hook are you using ?
And what are the Display Rules ?
after entry content.
display rules: all posts and all pages.
Have you tried clearing your browser caches ?
As i can see social icons on this page:
https://.......com/best-camera-for-streaming/4k/
Because I changed the hook to "generate after content"
And is that good for you ?
Yes.
I placed it in the wrong hook
Glad to hear that!
When I share a post it doesn't show the post feature image.
Is there a way to fix that?
I'm seeing the Post Featured image when I try to share on Facebook for instance.
Can you point us to a specific post where the issue is evident?
All the posts when i try to share them on whatsup
To the best of my knowledge WhatsApp uses OpenGraph og:image meta, so what works for Facebook - should work for WhatsApp.
Most sharing or SEO plugins handle this kind of thing.
Might be worth checking with the author of the sharing code you're using, they may have experienced a similar issue.