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 👉 Ultimate top of the best proteins: egg / beef / veal / poultry / lamb / offal / fish / shellfish / mature cheese / legumes
https://buff.ly/3Si8kfu

New shorts on Blooness 👉 Adding collagen to protein meals or eating cartilage with meat is one of the best ways to maintain muscle mass in terms of longevity.
https://buff.ly/4f8kMbs

New shorts on Blooness 👉 Secret of longevity: find meat from animals that are not mainly fed soybean meal, sunflower, corn, and other cereals.
https://buff.ly/3YpbrX5

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