0

Instead of using a plugin, I am manually adding buttons into my template file, like so:

<div class="fb-like" data-href="<?php get_permalink() ?>" data-width="100" data-layout="button_count" data-show-faces="false" data-send="false"></div>

However, when I have a multipage post, I don't want that the like button links to /the/post/2 on the second page, but to /the/post (i.e. the first page). I have been looking through the docs but there doesn't seem to be a way to get permalink of the post, without the page number. Can anyone help?

1 Answer 1

3

I don't think your code works as expected because you are not printing the URL of the post. Note that get_permalink() returns the permalink of current post inside a loop but doesn't print it like the_permalink(). So, you should use <?php echo get_permalink(); ?> or <?php the_permalink(); ?>.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.