Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What is the variable that holds the wp.me url? / What is the webservice / call that provides me the wp.me url? / What is the workaround to read that rel tag from the dynamic generator header (on a self hosted domain).

... to show it beneath each post.

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

WP 3.0 includes:

wp_get_shortlink()

which returns the ?p=1 style url for any post within your domain. This can be filtered, however for other shortening services, which is what the Wordpress.com Stats plugin does for self-hosted blogs. With that plugin installed and activated, wp.me shortlinks will be output instead of the default mydomain.com/?p=1, and can be retrieved with the function which can be used within the loop as:

echo wp_get_shortlink()

or to retrieve any post outside the loop:

$link = wp_get_shortlink($post->ID);
share|improve this answer
    
I was not aware of the fact that the stats plugin offers wp.me shortlinks. –  hakre Nov 9 '10 at 23:32
    
it's not exactly well-documented - I noticed it by accident ;-) –  somatic Nov 9 '10 at 23:50
add comment

wp.me shortlinks are a feature of wordpress.com. The were introduced in this article: WP.me — shorten your links.

On a wordpress.com webblog you can make use of that feature. The button which reveals the shortlink gets it from the page source, the link is stored there within a hidden input element.

So I'm unaware how this should be possible to use on other sites then wordpress.com, sorry.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.