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

  • Resolved Publishink


    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 linker plugin, but I would prefer to use your plugin with my api key. With linker, you can use the code below in your template:

    <?php bitly(); ?>

    Thanks in advance

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


    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 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 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 ‘[Plugin: URL Shortener] Insert plugin output in WP template file’ is closed to new replies.