Social icon plugins aren't working - is there a built in solution?

I’d like to have the social share icons show up on blogs and various other things I would want. I tried installing a couple of different Social Share plugins but none are populating.

Is there something built into the theme already that would handle this?

If not, how do I get these plugins to work properly?

Thanks.

Hi there,

Do you mean the social share icons? If so, it comes built in with X. You can use the Social Share element in Cornerstone.

If you aim to add the social share option to all of your post, please follow this thread:

Hmm, doesn’t seem to have done anything?

http://www.ohiocannabis.com/potcoin/

I also reinstalled the Simple Share plugin for this and have that option ticked in the appropriate areas, i.e. the posts page etc.

Does this look right?

<?php // Exit if accessed directly if ( !defined( 'ABSPATH' ) ) exit;

// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:

if ( !function_exists( ‘child_theme_configurator_css’ ) ):
function child_theme_configurator_css() {
wp_enqueue_style( ‘chld_thm_cfg_child’, trailingslashit( get_stylesheet_directory_uri() ) . ‘style.css’, array( ‘x-stack’,‘x-cranium-migration’,‘x-woocommerce’ ) );
}
endif;
add_action( ‘wp_enqueue_scripts’, ‘child_theme_configurator_css’ );

// Add Social Sharing after the single post content // ============================================================================= function x_add_social_sharing ( $content ) { if ( is_singular(‘post’) ) { echo do_shortcode(’[share title=“Share this Post” facebook=“true” twitter=“true” google_plus=“true” linkedin=“true” pinterest=“true” reddit=“true” email=“true”]’); } } add_action('x_before_the_content_…

// END ENQUEUE PARENT ACTION

Hello There,

Please update the code and use this instead:

// Add Social Sharing after the single post content
// =============================================================================

function x_add_social_sharing ( $content ) {
  if ( is_single() ) {
    echo do_shortcode('[x_share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]');
  }
}
add_action('x_before_the_content_end', 'x_add_social_sharing');

The is_single() is a condition that make sure that it will only display in the single blog posts only. If you want it to display in other pages, you can use is_singular().

Hope this helps.

This code seems to break my website:

[code]<?php
// Exit if accessed directly
if ( !defined( ‘ABSPATH’ ) ) exit;

// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:

if ( !function_exists( ‘child_theme_configurator_css’ ) ):
function child_theme_configurator_css() {
wp_enqueue_style( ‘chld_thm_cfg_child’, trailingslashit( get_stylesheet_directory_uri() ) . ‘style.css’, array( ‘x-stack’,‘x-cranium-migration’,‘x-woocommerce’ ) );
}
endif;
add_action( ‘wp_enqueue_scripts’, ‘child_theme_configurator_css’ );

// Add Social Sharing after the single post content // ============================================================================= function x_add_social_sharing ( $content ) {
if ( is_single() ) {
echo do_shortcode(’[x_share title=“Share this Post” facebook=“true” twitter=“true” google_plus=“true” linkedin=“true” pinterest=“true” reddit=“true” email=“true”]’);
}
}
add_action(‘x_before_the_content_end’, ‘x_add_social_sharing’);

// END ENQUEUE PARENT ACTION
[/code]

What is wrong?

HI there,

Please try:

<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;
// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:
if ( !function_exists( 'child_theme_configurator_css' ) ):
    function child_theme_configurator_css() {
        wp_enqueue_style( 'chld_thm_cfg_child', trailingslashit( get_stylesheet_directory_uri() ) . 'style.css', array( 'x-stack','x-cranium-migration','x-woocommerce' ) );
    }
endif;
add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css' );
// Add Social Sharing after the single post content // ============================================================================= 
function x_add_social_sharing ( $content ) {
  if ( is_single() ) {
    echo do_shortcode('[x_share title="Share this Post" facebook="true" twitter="true" google_plus="true" linkedin="true" pinterest="true" reddit="true" email="true"]');
  }
}
add_action('x_before_the_content_end', 'x_add_social_sharing');
// END ENQUEUE PARENT ACTION

Awesome that worked, thank you!

Is this the X Theme social share icons?

So I can delete the simple share plugin?

What if I wanted to use the simple share plugin because of their icons?

Hi there,

Yes, that is using the social share option that is built in with X.

Yes you may if you want to use the X Social Share instead.

I am not certain how the Simple Share plugin works but if they have a shortcode to use for every post, you can substitute the x_share shortcode that is currently in the code to their shortcode.

Ok this worked then it seems to have stopped working or not working on new posts created?

Hello there,

I’ve checked your site, and can’t see any errors on your console. Moreover, I’ve checked Inspect Element if there are X Social Share related <div />'s, and there was none. With this, this means that X Social Share wasn’t rendered.

Before anything else, please follow troubleshooting steps below:

  1. If you’re using a CDN, please clear the CDN’s cache and disable optimization services.
  2. Test for a plugin conflict. You can do this by deactivating all third-party plugins, and see if the problem remains. If it’s fixed, you’ll know a plugin caused the problem, and you can narrow down which one by reactivating them one at a time.
  3. Remove custom CSS and Javascript from the options or Child Theme and test the case.
  4. Reset your htaccess file by renaming it to .htaccess-bak. Then in WP Admin Menu, go to Settings > Permalinks and just click the Save Changes button.
  5. Increase the PHP Memory Limit of your server. Click here for more detailed information and how to increase the PHP memory limit.

If issue persits, can we ask for your Wordpress User/Pass & FTP Host/User/Pass so we can take a closer look?

Thank you.

Yeah none of that seemed to work.

I just don’t know why they would work when I added the code isn’t working now.

I could give access, how/where do we do that securely?

Hi there,

Please post the login details in a Secure Note which is the lock icon under you replies.

Thank you.

Ok, done - thank you!

Hi There,

The code will add a social share icons to all your single posts, it does not matter if it’s new or old post the social share icons should show up.

Ok this worked then it seems to have stopped working or not working on new posts created?

That means you either edit the code and broke it, or you did install/activate a new plugin and caused a conflict.

Please copy and re-paste the last code provided by Jade or deactivate the last plugin you install/activated and see which is causing the issue.

Thank you for the credentials, but what is your login page URL? this /wp-login.php and /wp-admin is redirecting to 404 page.

Cheers!

Ok I re-added the code and it’s back to working.

I guess I forgot I upgraded to pro & must have done it after adding the social icons code.

Thanks guys!

We are delighted to assist you with this.

Cheers!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.