Tulip Media

Entrepreneurial thoughts

Create a shortcode for the permalink of a WordPress article

I needed to create a shortcode allowing me to display the link to a WordPress article. To do this, here is the code that I added to my functions.php file:

[coded]
add_shortcode('my_permalink', 'my_permalink');
// The Permalink Shortcode
function my_permalink() {
ob_start();
the_permalink();
return ob_get_clean();
}
[/coded]

And all you had to do was use the shortcode [my_permalink] to have the direct link to your WordPress post.

Source.

 

My latest tweets

New shorts on Blooness 👉 Vitality, longevity, weight loss: the ultimate guide to proteins in the keto-Mediterranean diet is online on Blooness. https://buff.ly/3xxNvpj
https://buff.ly/4cG2GM4

New shorts on Blooness 👉 The new premium content comes out in 48 hours, and what content! This will be the most comprehensive guide on the amount of protein to consume on a keto-Mediterranean diet. See you soon !
https://buff.ly/3L2KbFP

New Post: Combo, the best solution to put an end to the headache of scheduling and HR management https://buff.ly/4eE6JtT

Load more

Don't miss business advice by email

No spam, just an email when new content is published.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEN