WordPress.org

Support

Support » Plugins and Hacks » URL Shortener » [Resolved] [Plugin: URL Shortener] Insert plugin output in WP template file

[Resolved] [Plugin: URL Shortener] Insert plugin output in WP template file

  • Thank you for this plugin.

    Is there a way to have more control over where the short url is output in a post? Currently, the output appears at the end of the post content, but I would like to mix the short url in with the post metadata.

    You can do this with the bit.ly linker plugin, but I would prefer to use your plugin with my goo.gl api key. With bit.ly linker, you can use the code below in your template:

    <?php bitly(); ?>

    Thanks in advance

    http://wordpress.org/extend/plugins/url-shortener/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gerald

    @geraldyeo

    Hi Publishink,

    to display, you can use the WordPress template tag:

    <?php the_shortlink(); ?>

    Thanks, Gerald.

    Sorry, Gerald. Just tried this, but it returns the wp shortlink, not the goo.gl shortlink I’m generating using this plugin.

    Nor does it display the actual link, rather it returns the default wording ‘This is the shortlink’. I know how to change that wording, but I’m looking for a way to display the Google shortlink elsewhere than at the foot of a post.

    The bit.ly linker plugin handles this well, and all is explained, but obviously it doesn’t do Google.

    The method you suggest also results in two shortlinks, the one generated by the plugin, which is still at the foot of the post, and the one generated by your suggestion, which is added to my metadata.

    Worked it out. The result I’m looking for is achieved using the following code to display the Google short url generated by the plugin:

    <?php echo wp_get_shortlink(); ?>

    Also, in the plugin settings, I should have checked ‘URL shortener integration’, unchecked ‘Use Permalinks for short URLs, and I had ‘Append URL to … Posts’ checked.

    Once I’d made these changes, I was able to add the Google short URL to my metadata.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] [Plugin: URL Shortener] Insert plugin output in WP template file’ is closed to new replies.
Skip to toolbar