Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1180712

    Hi guys,

    some time ago you gave me the following code to insert “via @…” for Twitter sharing:

    /*TWITTER SHARING CUSTOMIZATION*/
    add_filter('avia_social_share_link_arguments', 'avia_add_social_share_link_arguments', 10, 1);
    function avia_add_social_share_link_arguments($args)
    {$args['twitter'] = array("encode"=>true, "encode_urls"=>false, "pattern" => "https://twitter.com/share?text=[title]&url=[shortlink]&via=Anton_Malafeev"); return $args;}

    Is that possible to add the same “via @…” to the Facebook share button ? I’d like to make people sharing via one of my FB pages.

    Cheers,

    #1181670

    Hi Anton,

    I’m not very familiar with via in facebook but if you want to add it in the url, you can do that, you can use this code (combined with your twitter sharing code above):

    function avia_add_social_share_link_arguments($args) {
      $args['twitter'] = array("encode"=>true, "encode_urls"=>false, "pattern" => "https://twitter.com/share?text=[title]&url=[shortlink]&via=Anton_Malafeev"); 
      $args['facebook'] = array("encode"=>true, "encode_urls"=>false, "pattern" => "https://www.facebook.com/sharer.php?u=[permalink]&t=[title]"); 
      return $args;
    }
    
    add_filter('avia_social_share_link_arguments', 'avia_add_social_share_link_arguments', 10, 1);

    Best regards,
    Nikko

    #1183658

    Hi Nikko,

    thank you for this attempt, but I did not manage to get this line of code to work. I tried this
    $args['facebook'] = array("encode"=>true, "encode_urls"=>false, "pattern" => "https://www.facebook.com/sharer.php?u=[permalink]&t=[title]&@AntonMalafeev"); return $args;
    and
    $args['facebook'] = array("encode"=>true, "encode_urls"=>false, "pattern" => "https://www.facebook.com/sharer.php?u=[permalink]&t=[title]&via=AntonMalafeev"); return $args;
    none works.
    Maybe we should use another syntax?

    #1183743

    Hi Anton,

    I tried to check on facebook: https://developers.facebook.com/docs/plugins/share-button/ but I could not find ‘via’ as a parameter.
    If you can give a link that points out the right parameter on the url that is permitted by facebook, please do so and we’ll try to give you an accurate code.

    Best regards,
    Nikko

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.