How to Disable XenForo Share Buttons

  • Thread starter Newman
  • Start date
Newman

Newman

New Member
Joined
May 11, 2021
Messages
11
Reaction score
0
Points
1
  • #1
I have share buttons on my forum and I'd like to remove them from the bottom of my pages. I can't seem to locate the setting for this. Is there any way to remove the share links from my forum?
 
WendyMay

WendyMay

New Member
Joined
May 11, 2021
Messages
11
Reaction score
0
Points
1
  • #2
I'm not sure which share buttons you're referring to. There is one share button per post on every thread page and then there are share to social media buttons that come set to visible by default (I think) down at the bottom of the thread pages. I'm not sure if they're also visible at the bottom of the forum pages as well as on the forum list page. Nevertheless, these share buttons are the ones with a social media site logo icon for each button.

There are also share buttons that you may add via widget. The settings that control which social media sites appear as links down at the bottom of the pages also control which sites (links) appear in the widget.

How to Remove XenForo Share Button From Posts​


I'll start off with how to remove the share button from the individual posts on a thread page. If you look above each post and to the right, you'll see some buttons that look like this:

xenforo-post-share-links.gif

The share button is all the way to the left. By default, this is turned on. To stop the link from functioning, you can access the post_macros template by navigating the admin area to Appearance > Macros > post_macros.

Once on that page, search for this code:

<a href="{{ link('threads/post', $thread, {'post_id': $post.post_id}) }}" class="message-attribution-gadget" data-xf-init="share-tooltip" data-href="{{ link('posts/share', $post) }}" aria-label="{{ phrase('share')|for_attr }}" rel="nofollow"> <xf:fa icon="fa-share-alt"/> </a>

To remove the functionality of the button altogether, you can replace the above code with this:

<xf:fa icon="fa-share-alt"/>

If you wanted to remove the link (functionality) only for guests, but not for registered members, you can use this code:

<!-- REMOVE SHARE TOOLTIP LINK FOR GUESTS --> <xf:if is="$xf.visitor.user_id"> <a href="{{ link('threads/post', $thread, {'post_id': $post.post_id}) }}" class="message-attribution-gadget" data-xf-init="share-tooltip" data-href="{{ link('posts/share', $post) }}" aria-label="{{ phrase('share')|for_attr }}" rel="nofollow"> <xf:fa icon="fa-share-alt"/> </a> <xf:else /> <xf:fa icon="fa-share-alt"/> </xf:if> <!-- REMOVE SHARE TOOLTIP LINK FOR GUESTS -->

It's basically an if/else statement that says, if guest, then show only the icon, but if not guest, then show the fully functional share link.

If you'd like to completely remove the share function and icon from every post, just delete all of the code from above.

How to Remove XenForo Social Share Buttons​


Now, for this one, it really depends on what your goal is. Is it to simply hide the buttons, but keep the links to them on all of the pages? If so, you can add this code to the extra.less template:

<xf:css> .blockMessage .shareButtons { display:none; } </xf:css>

Honestly, that's a pretty silly thing to do. While yes, you are hiding the buttons from view, you're not hiding the dofollow outbound link from search engine crawlers. There's no sense in this. As long as you're hiding the buttons, you may as well reduce the pagerank leak that occurs by having outbound links on your pages.

A better solution is to access the Setup > Options > Sharing page in the admin area and uncheck all the boxes for the social media websites. Once that's done, click the Save button and those buttons will disappear.

Let me know if this helps.
 
How to Disable XenForo Share Buttons was posted on 05-24-2021 by Newman in the XenForo forum.

Forum statistics

Threads
88
Messages
156
Members
17
Latest member
mandy cromarty
Looking for an all-around awesome forum? Check out IndyFor!
Top