How to Display WordPress Short link in Your post and link tag

From wordpress 3.0 version you can add the short link in your post through wordpress api. For social networking you want to add the short links in your post.

Adding shortlink tag in head section is always good ieda for SEO. short link will look like as follows:

<link rel='shortlink' href='http://wp.me/p1kxw4-1uP' />

For adding short link in your single post you need to the following code in to your single.php file.

   if ( function_exists('the_shortlink') ) the_shortlink( __('Shortlink'), __('wordpress api short link'), ' · ' );

For adding the shortlink support in admin panel you need to add the following code in to functions.php file.

    add_action( 'wp_head', 'wp_shortlink_wp_head', 10, 0 );

For adding the short link in head section add following code.


<link rel='shortlink' href='<?php if (function_exists('wp_get_shortlink')) { echo wp_get_shortlink(get_the_ID()); } ?>' />

For more detailed information you  can check following article.

Getting Shortlink in WordPress admin panel

You may like following Articles!

This entry was posted in wordpress, wordpress api and tagged , , , , by Wordpress API. Bookmark the permalink.

About Wordpress API

API means Application Program interface. In Wordpress API we are giving all the information about wordpress API. We worked for many wordpress plugins and themes. We have expertise in PHP, Databases, Graphic Design, Ruby on Rails, Java, Wordpress, Drupal and many CMS. We always give you the best solutions about wordpress and other related topics in This Blog. We will give you always fresh tips and tricks and techniques about wordpress in this blog.

2 thoughts on “How to Display WordPress Short link in Your post and link tag

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>