AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

Filter by custom fields

Topic prefix

AI Assistant
Notifications
Clear all

[Closed] My forum share button is selecting a particular image thumbnail for all the post,topic discussions

9 Posts
4 Users
0 Reactions
5,530 Views
Posts: 4
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@hertzelectroz)
Active Member
Joined: 7 years ago
[#8075]

please how can i fix this error in my site, please can anyone help


8 Replies
Robert
Posts: 10716
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 2 months ago

Please leave your website URL to allow us check it. And provide an example.


1 Reply
(@hertzelectroz)
Joined: 7 years ago

Active Member
Posts: 4
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

https://hertzelectroz.com/community/


Robert
Posts: 10716
Admin
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@robert)
Support Team
Joined: 2 months ago

You don't have any image in topics and posts so it selects first found image from your website. This is normal. wpForo detects images in topic first post content when you try to share a topic and it sets found first image as share image. Here is a good topic to see that in action: https://wpforo.com/community/general-discussions/sharing-wpforo-links-on-linkedin/

For non-topic (forum home, forums and other) pages and for topics without an image wpForo allows to set default share image.  That's the default share image (og:image share tag) . You should put this code in WordPress theme functions.php file to set it. Just change the red marked image URL to your website/forum logo URL or to something else, it'll be the default share image:

function my_default_og_image( $image_url, $type ){
if( $type == 'og:image' && !$image_url){
return 'https://example.com/images/mylogo.jpg';
}
else{
return $image_url;
}
}

add_filter('wpforo_find_image_url', 'my_default_og_image', 10, 2);

How to Easily Add Custom Code in WordPress (without Breaking Your Site)

 

 


Posts: 23
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@illinipulse)
Eminent Member
Joined: 7 years ago

Searching through the help forum and ran across this topic.

Is there a way to share a specific image from a post to Twitter/Facebook, or only the default option above?


Posts: 23
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@illinipulse)
Eminent Member
Joined: 7 years ago
Posted by: @robert

function my_default_og_image( $image_url, $type ){
if( $type == 'og:image' && !$image_url){
return 'https://example.com/images/mylogo.jpg';
}
else{
return $image_url;
}
}

add_filter('wpforo_find_image_url', 'my_default_og_image', 10, 2);

I entered this into my child theme (after changing the image example to my own) and it doesn't work.  Any ideas?


1 Reply
(@illinipulse)
Joined: 7 years ago

Eminent Member
Posts: 23
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian

I put into my main theme functions.php and it still didn't work.  I get this:


Page 1 / 2
Share: