• Resolved doudou12

    (@doudou12)


    Hi,

    I use my own url shortener which writes a post meta_data for each post, where I can add a code to get this data and display with buttons,

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Heateor Support

    (@heateor)

    Hi there,

    You can use following code to use your url shortener:

    /**
     * Use custom url shortener
     */
    function heateor_sss_custom_url_shortener( $post_url, $sharing_type, $standard_widget ) {
    
        // you can get/create the short url here
        return $short_url;
    
    }
    add_filter( 'heateor_sss_target_share_url_filter', 'heateor_sss_custom_url_shortener', 10, 3 );
    Thread Starter doudou12

    (@doudou12)

    Thank you ??

    It’s perfect, here is my code (it works with plugin better yourls which writes a post meta with the short link)

    function heateor_sss_custom_url_shortener( $post_url, $sharing_type, $standard_widget ) {
    
        $post_id = get_the_ID();
        $short_url = get_post_meta( $post_id, '_better_yourls_short_link', true );
        return $short_url;
    
    }
    add_filter( 'heateor_sss_target_share_url_filter', 'heateor_sss_custom_url_shortener', 10, 3 );
    Plugin Author Heateor Support

    (@heateor)

    You’re welcome ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Own url shortener’ is closed to new replies.