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 👉 Relaunch libido, in bulk -> Sun, vitamin D, keto-Mediterranean diet, proteins, books, banter, walking, HIIT, and no hypocalorie diet.
https://buff.ly/445PWvc

New shorts on Blooness 👉 Improve your sleep -> expose yourself to light in the morning, limit sunglasses, wet your shirt during sports, drink decaf, eat maximum 3 hours before sleeping, take a digestive walk and take some melaton
https://buff.ly/440weAJ

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