WordPress.org

Ready to get started?Download WordPress

Forums

YOURLS Link Creator
[resolved] How to use YOURLS shortlink in theme php (8 posts)

  1. nheinis
    Member
    Posted 1 year ago #

    I'm creating my own WordPress theme.
    I would like to retrieve a post's shorturl, as created with the YOURS link creator. How can I do this?

    http://wordpress.org/extend/plugins/yourls-link-creator/

  2. Andrew Norcross
    Member
    Plugin Author

    Posted 1 year ago #

    the URL is stored in the postmeta table for each post. the key is _yourls_url. So you would want to get it using the get_post_meta call where appropriate

  3. prokopino
    Member
    Posted 1 year ago #

    can you please show me an exable of how i can use this option?
    lets say, i want to show in the visitors this:

    "the sortlink of this post for sharing is: "_yourls_url"

    how can i build the code to include it to my theme file? (i know how to include in theme, i dont know how to build the code snippet...

    thank you for your support!

  4. Andrew Norcross
    Member
    Plugin Author

    Posted 1 year ago #

    I'm adding a template tag in the next release and will include that in the readme file.

  5. Andrew Norcross
    Member
    Plugin Author

    Posted 1 year ago #

    @prokopino I've just added a template tag in the 1.06 release. To use in your theme, just add do_action('yourls_display'); anywhere within the post loop.

  6. prokopino
    Member
    Posted 1 year ago #

    thank you! very usefull for our sites!

  7. Andrew Norcross
    Member
    Plugin Author

    Posted 1 year ago #

    glad you find it useful!

  8. chuckingit
    Member
    Posted 1 year ago #

    Hey Andrew - great plugin and really impressed thus far ... reason for chiming in is i think a conditional is perhaps best when adding to theme files - e.g.,
    `
    <?php if ( has_action( 'yourls_display' ) ) { do_action('yourls_display'); } ?>
    `

    the other thing, and perhaps this is off topic a bit, i'm really looking to get the YOURLS short url to integrate with my post's social sharing icons ... currently using another plugin that allows for Blitly integration and wonder if your plugin could to a wp_get_remote to pull the sharing links that YOURLS provides ..??.. since at the end of the day, i would like my short links to really be default shared when people click on sharing icon in WP post footers but i digress ...

    thanks again for another Winning Norcross Plugin :>) cheers - chuck scott

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic