Please or Register to create posts and topics.

Adding Sumo Inline Sharing Code

Page 1 of 2Next

I have Sumo Social sharing plugin on my Wordpress site, and the Sumo buttons appear on every page of the website and share Wordpress blog posts correctly (the links generated do go to the blog post being shared).

However, when I try to share an Asgaros forum post, the link given by the share button is just to the page e.g. the forum, rather than the actual Asgaros post.

Example: If I am trying to share https://catteachers.com/forum/topic/share-your-cat-photo/ the link from the share button will be https://catteachers.com/forum/

I am trying to fix this by adding the share buttons in-line with each Asgaros post. On the Sumo site it says this:

“Design and create inline codes for Sumo Share to place where you want them on your website.

Insert the following HTML codes in the <body> of your website to where you want Share to display.”

Then it gives me a code like this <a data-sumome-share-id=4ed1c2dd-f99e-4d1c-8009-></a>

 

Is there a way to insert this code into the <body> of Asgaros posts? I cannot work out which file I should add this code to.

Can you advise please? Thank you.

Hello @tablestest

You can use the asgarosforum_after_post_message hook to add custom code to the end of specific posts:

add_action('asgarosforum_after_post_message', 'my_function_share', 10, 2);
function my_function_share($author_id, $post_id) {
    echo 'Your code';  
}

 

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thank you.

I put the code into my theme’s functions.php file and it added the share buttons to each post. So that part worked well.

Unfortunately the new share buttons still share the url of the forum as a whole rather than the url of the individual post.

I guess the sharing button software is unable to find the Asgaros forum post url for some reason.

(It does find the Wordpress blog url successfully so I imagine there is a different structure for Wordpress blogs compared to Asgaros forum posts.)

Thank you for your reply anyway. (Really like the Asgaros Forum software – thank you for creating it)

Hello @tablestest

I assume that the plugin which you are using just takes the page-url. The point is, that the individual forum-topics and other related forum-views are actually not different pages in WordPress itself because the content of the forum-page is just based on additional parameters. So what the plugin must do is to take the actual complete URL instead of the current page-URL. Maybe there is a setting or another trick for configuring it but you should contact the plugin-developer for more information about this.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

Thank you. That is helpful.

I will contact the creators of the Sumo sharing plugin.

Best wishes.

In case it helps anyone else:

I have found the problem is related to the Yoast SEO plugin.

When I disable the Yoast plugin I CAN share forum posts properly using my Share plugin.

It seems that with the Yoast SEO plugin activated, 2 sets of OG data are produced on an Asgaros Forum post.

One set of OG data refers to the forum page and one set of OG data refers to the forum post. The Share plugin uses the first set of OG data.

So for now I have deactivated the Yoast SEO plugin and I can share my Asgaros Forum posts.

 

Best wishes.

Hello again @tablestest

Yes, you are right. Asgaros Forum has its own built-in SEO-functionality because other SEO-plugins cannot know how every other plugin out there works. So it seems that Yoast SEO created a second set of og-meta-data in the header and sites of course take the first one.

To fix this its always helpful to disable SEO-plugins for the forum-page.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!

You can leave the YOAST SEO Active and use this in you functions.php

add_action('template_redirect','remove_wpseo');

function remove_wpseo(){
    if ( is_page( 'YOU_ASGAROS_PAGE_ID_HERE' ) ) {
        global $wpseo_front;
            if(defined($wpseo_front)){
                remove_action('wp_head',array($wpseo_front,'head'),1);
            }
            else {
              $wp_thing = WPSEO_Frontend::get_instance();
              remove_action('wp_head',array($wp_thing,'head'),1);
            }
    }
}

cheers!

Thanks for the code N3k0

Is “YOU_ASGAROS_PAGE_ID_HERE” the URL for my forum or something else?

Or do I insert the code exactly as you have written it?

Best wishes.

@tablestest You have to replace it with the numerical id of your page which contains your forum. As an alternative just disable Yoast for the page which contains the forum-shortcode only.

If you want to support the development of Asgaros Forum, you can leave a good review or donate. Thank you very much!
Page 1 of 2Next