How to add the share button in WordPress without plugin / Javascript

WordPress is a CMS that is widely used to create a blog. Most of the websites on the internet dominate the use of WordPress. The reason WordPress is so widespread that WordPress is not only free, but it has many other useful features as well.

If you use WordPress, you can choose the theme you want to use yourself. Usually each topic has a pretty complete built-in function. In some themes, however, there is usually no share or. Button available share to social media. Although the button share or share it is very useful.

Well, if you don’t have a button on your WordPress website share or share button, you don’t have to worry. On this occasion we will show you how to make a button share or share on WordPress, without plugins and Javascript. Of course, if you don’t use plugins and Javascript, your website and storage will be lighter.

Tutorials

* The following tutorial was created in WordPress, that is Use IndonesianIf your WordPress website uses English, you can customize it.

1. Please log in first or Log in to the WordPress website You can access it directly via namawebsite.com/wp-admin, then log in with your username and password.

How to add a share button or share in WordPress without plugin & Javascript

2. Next press Menu Appearance that’s on the left.

How to add a share button or share in WordPress without plugin & Javascript

3. Then a new menu will appear and select Menu Theme editor.

How to add a share button or share in WordPress without plugin & Javascript

4. Look for the right one, exactly in the Topic Files section, find and select the file Theme functions (functions.php)Then copy the code below into the file right at the end of the code Features.php it and press the button Update file.

function crunchify_social_sharing_buttons($content) {    global $post;    if(is_singular() || is_home()){            // Get current page URL         $crunchifyURL = urlencode(get_permalink());         // Get current page title        $crunchifyTitle = htmlspecialchars(urlencode(html_entity_decode(get_the_title(), ENT_COMPAT, 'UTF-8')), ENT_COMPAT, 'UTF-8');        // $crunchifyTitle = str_replace( ' ', '%20', get_the_title());                // Get Post Thumbnail for pinterest        $crunchifyThumbnail = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' );         // Construct sharing URL without using any script        $twitterURL = 'https://twitter.com/intent/tweet?text=".$crunchifyTitle."&url=".$crunchifyURL."&via=Crunchify';        $facebookURL = 'https://www.facebook.com/sharer/sharer.php?u='.$crunchifyURL;        $googleURL = 'https://plus.google.com/share?url=".$crunchifyURL;        $bufferURL = "https://bufferapp.com/add?url=".$crunchifyURL."&text=".$crunchifyTitle;        $linkedInURL = "https://www.linkedin.com/shareArticle?mini=true&url=".$crunchifyURL."&title=".$crunchifyTitle;         // Based on popular demand added Pinterest too        $pinterestURL = "https://pinterest.com/pin/create/button/?url=".$crunchifyURL."&media=".$crunchifyThumbnail[0]."&description='.$crunchifyTitle;         // Add sharing button at the end of page/page content        $content .= '






Leave a Reply

Your email address will not be published.