Create Facebook share button by Hool using HTML code?

[ad_1]

I’m using this code to create the Share button, but it only work to share a fixed link.

I wanna make this hook available for all post, and with each post, it will share itsefl link but not a fixed link like the code below.

Here is the code:

<!– Your share button code –>

<div class=”fb-share-button”

data-href=”[https://vantuanle.com/blog/cai-youtube-vanced-cho-iphone/]”

data-layout=”button\_count”>

</div>

I try to find the solution but it tell me to use this php code to single.php after

<header class=”entry-header”>…</header>

add\_action( ‘the\_post’, ‘add\_facebook\_share\_button’ );

function add\_facebook\_share\_button() {

global $post;

$permalink = get\_permalink( $post->ID );

?>

<!– Your share button code –>

<div class=”fb-share-button”

data-href=”<?php echo esc\\\_url( $permalink ); ?>”

data-layout=”button\_count”>

</div>

<?php
}
but my single.php file doesnt has that code so i cant insert.

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer