Nathalie
Nathalie

Reputation: 111

How to add a "get permalink" button to post in wordpress?

I am working in this spanish comic website: www.tuscomics.com

And I would like some help to display a button above every post that will copy to clipboard or displays the permalink of the post, so it's easy for people to link their friends to a post they like.

I have been searching for a plugin with no luck.

Thank you very much!

Nathalie.

Upvotes: 0

Views: 1995

Answers (2)

Gary
Gary

Reputation: 1179

You could use get_post_permalink() to return the link, then output it inside of a button as @Ljubisa suggested.

So long as it's used inside of the 'The Loop', you don't need to supply an ID.

http://codex.wordpress.org/Function_Reference/get_post_permalink

Upvotes: 1

I am Cavic
I am Cavic

Reputation: 1085

<?php the_excerpt();?>

<?php echo "<form action='";
     echo the_permalink();
     echo "' method='get'>";?>
<button>Read More..</button>

So first part is your article, second part is the button form, you need it in the form otherwise it will give W3 error you can't have it with out form.

I hope that helps you.

Upvotes: 0

Related Questions