Home / links / Shortlink trick
  • How to Shortlink trick

    no thumbnail sorry: Shortlink trick

    Add this code snippet to your single.php or within the loop of your theme. This will display a text field and when clicked becomes selected for easy copy and paste. Thanks Otto

    ( click code to copy )

    wordpress snippet : PHP

    <?php if (function_exists('wp_get_shortlink')) { ?>
    <div><span class="post-shortlink">Shortlink:
    <input type='text' value='<?php echo wp_get_shortlink(get_the_ID()); ?>' onclick='this.focus(); this.select();' />
    <?php } ?>

    ( WordPress codex functions, hooks, in this snippet. )

    get_the_ID, the_ID, _e, _ex, wp,