Defined function isn’t showed on page

There’s no relationship between how the function is written, and how you’re attempting to use it.

The first problem is that your function returns a value, rather than echoing it. So if you wanted to output the value you need to use echo:

echo social_sharing_buttons('post');

But the usage of 'post' doesn’t make sense here. Your code will just output this:

<div class="post_cont_info entry-meta">
    <div class="social">
        <a class="link facebook" href="https://wordpress.stackexchange.com/questions/330985/(etc. etc.)" target="_blank">Facebook</a>
    </div>
    post
</div>

Notice the post hanging out there at the end.

This is because your social_sharing_buttons() function is written to filter the_content() so that your custom link appears at the top of the post content. This means that it accepts the full content of the post as an argument — not a post type — and then returns the value back to WordPress to be output by the the_content() function. So you can’t use it to output the share link in an arbitrary template.

If you want to write the function so that it only outputs this link, you need to rewrite it to look like this:

function social_sharing_buttons( $after="" ) {
    $variable="";

    if ( ! is_page() ) {
        $url = urlencode( get_permalink() );

        $facebookURL = 'https://www.facebook.com/sharer/sharer.php?u=' . $url;

        $variable .= '<div class="social">';;
        $variable .= '<a class="link facebook" href="'.$facebookURL.'" target="_blank">Facebook</a>';
        $variable .= '</div>';
    }

    return $variable . $after;
}

Note the following changes:

  • The $content parameter has been renamed something generic that makes sense even if it’s not used as a filter, and has been given a default value so that you can echo it without passing an argument.
  • global $post has been removed, since it served no purpose.
  • $Title has been removed, because sharer.php does not support any other parameters than the URL, so it served no purpose.
  • $variable has been removed to avoid unnecessary repetition in an else condition.

Now you can output it like this:

echo social_sharing_buttons();

But it will also work as a filter for the_content():

add_filter( 'the_content', 'social_sharing_buttons' );