WordPress.org

Ready to get started?Download WordPress

Forums

URL Shortener
[resolved] using the action hooks (2 posts)

  1. 406media
    Member
    Posted 4 years ago #

    i'm having trouble figuring out how to get the shortlink to pass to twitter. i have the feeling you can get it using the new action hook, but i can't figure it out or find any documentation on it. any help would be much appreciated. thanks.

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

  2. Gerald
    Member
    Plugin Author

    Posted 4 years ago #

    An example usage of the hook

    function duplicate_field($post_id, $shortlink){
    	add_post_meta($post_id, 'duplicate', $shortlink);
    }
    add_action('fts_use_shortlink', 'duplicate_field', 10, 2)

    The above code snippet will add a second custom field with the shortlink as the value...

    So, if you want to add an action to post to twitter:

    function to_twitter($post_id, $shortlink){
    	/*your twitter functions here*/
    }
    add_action('fts_use_shortlink', 'to_twitter', 10, 2)

    For more about action hooks, check out:
    http://codex.wordpress.org/Function_Reference/add_action

    Do check the URL shortener wiki as well:
    http://wiki.fusedthought.com/docs/url-shortener-wordpress-plugin/v3
    I'll try to expand the hook documentation in the future.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic