简体   繁体   中英

Facebook like box, liking specific url

G'day, I managed putting in the like button in there. Challenge is now when I press "like" it only likes the homepage, because that's where it's located. But this button is supposed to "like" the (blog)post which it's (not yet)directed to.

How to direct it to the post? Cheers

to visualize it: http://robertstam.nl/wp-content/uploads/2014/08/socialexample.jpg

<div class="meta">
                    <time datetime="<?php echo get_the_date(__('Y-m-d\TH:i:sP', 'bunyad')); ?>" itemprop="datePublished"><?php echo get_the_date(); ?> </time>

                    <?php echo apply_filters('bunyad_review_main_snippet', ''); ?>

         <?php if (strtolower(ICL_LANGUAGE_NAME_EN) == 'english'): ?>
         <?echo ('[fb_button]'); ?> 
         <?php endif; ?>

                    <span class="comments"><a href="<?php echo esc_attr(get_comments_link());?>"><i class="fa fa-comments-o"></i>
                        <?php echo get_comments_number();?></a></span>

                </div>

Take a look at FB API reference for LIKE . It may be possible that your 'fb_button' markup does not hold the correct value for the link property. The 'link' may be pointed to your homepage instead of your specific post url.

https://developers.facebook.com/docs/graph-api/reference/v2.1/link https://developers.facebook.com/docs/plugins/like-button

It would help if you post the codes behind 'fb_button'.

also, this is does not seem right.

<?echo ('[fb_button]'); ?> 

Be consistent.. choose one of these ...

<?php echo('[fb_button]'); ?> // forgot php

<?="[fb_button]"?> // php short tags

<?php echo do_shortcode('[fb_button]'); ?> // to execute shortcode in a template

Used the facebook like plugin before. Now with the facebook like button creator I added <?php the_permalink(); ?> <?php the_permalink(); ?> in order to refer to the post

  <?php if (strtolower(ICL_LANGUAGE_NAME_EN) == 'english'): ?>
    <div class="fb-like" data-href="<?php the_permalink(); ?>" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true">
    </div><?php endif; ?>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM