Specify custom text for social sharing

I’d like to be able to specify the actual text that gets tweeted or shared. It seems that what gets written in there by default is the blog title and URL. But there is no opportunity to add any descriptive text, hash tags, etc.

Most users will not know, care, or bother to add anything more compelling than that, so the sharing will not have much impact.

We really need the ability to customize each post depending on which social network it is going to. I want to use more than 140 characters on Linkedin, for example.

Otherwise, a really great and exciting addition. But this is really crucial to make it really effective.

  • Hakan
    • The Incredible Smush

    Hi greymatter,

    It seems that what gets written in there by default is the blog title and URL. But there is no opportunity to add any descriptive text, hash tags, etc.

    In fact in some cases (e.g. Twitter and LinkedIn) visitor who clicks the like button can write a description. But what I understand from your above sentences, you want to freely define how your page will be described in the Social Networking website (Facebook, Twitter, etc…:wink:.

    This is not supported (or more clearly, not allowed) by the social networks themselves, i.e. it is not something that this plugin or any similar plugin can do.

    When you insert a like button, you agree that social network can scan your page and take any information it chooses. You and I have no control over any part of it.

    What can do is to keep your description meta tag current and informative.

    Cheers,

    Hakan

  • greymatter
    • Flash Drive

    Actually, Hakan, you had it right the first time. All I’m looking for is the ability to provide the default message that the visitor will tweet or post. For example, my tweet last night when I tried my own use of PWAL was simply

    Red Pill Trading Systems http://redpilltradingsystems.com/the-9-most-deadly-trading-mistakes/

    That’s not very compelling. I would like to be able to configure the message that the user will send out by default to something more like

    I just downloaded a free report on the 9 Most Deadly Trading Mistakes from Red Pill Trading Systems http://redpilltradingsystems.com/the-9-most-deadly-trading-mistakes/ #freereport

    Yes, the visitor can write their own, but most won’t. Most will just click Tweet or Post and send whatever pops up. I want to have control over what it is that pops up.

    What I meant about the different networks was simply that you have more room on Facebook than you do on Twitter, so I would want to be able to set a different message for each network.

    Also, I think the Facebook side needs to include the ability to post a comment, not simply a Like.

    Thank you!

  • Hakan
    • The Incredible Smush

    Hi greymatter,

    I had already read your previous message, I read all messages about the plugins I developed (because they are not too much :stuck_out_tongue:). However this is a feature request and development of feature requests are not up to the developer. You should try to collect some user votes to make it done :slight_smile:

    Cheers,

    Hakan

  • greymatter
    • Flash Drive

    This seems like an obvious, almost essential, feature. In order for your tweet or share to be meaningful, it needs to be compelling. You can’t count on your audience to write compelling copy for you. The default tweet is so dull that no one will be interested in it.

    How do I gather user votes?

  • Hakan
    • The Incredible Smush

    Hi all,

    I have already presented the solution to specify custom texts in another thread. Please see this:

    https://premium.wpmudev.org/forums/topic/pay-with-a-like-shows-suspect-description

    There you will see examples for Twitter button for a) Using post title instead of what is included in <title> tag b) Using a fixed custom text.

    For completeness I am copying them here.

    a) Adding post title as custom text. (Normally Social buttons take whatever inside <title> tag, which may include your website description and you may not want it to be in the button):

    add_filter( "pwal_render_button_html", "add_post_title_to_twitter", 10, 2 );
    function add_post_title_to_twitter ( $content, $post_id ) {
    if ( !$post_id )
    return $content;
    $post = get_post( $post_id );
    return str_replace( "class='twitter-share-button'", "class='twitter-share-button' data-text='". $post->post_title ."'", $content );
    }

    b) Adding a fixed custom text which is the same for every PWAL protected post

    add_filter( "pwal_render_button_html", "add_post_title_to_twitter", 10, 2 );
    function add_post_title_to_twitter ( $content, $post_id ) {
    $custom_title = "Whatever";
    return str_replace( "class='twitter-share-button'", "class='twitter-share-button' data-text='". $custom_title ."'", $content );
    }

    Please also note that it is possible to use different custom texts for each post by using post metas. Like this:

    c) Adding different custom texts for each post:

    add_filter( "pwal_render_button_html", "add_custom_text_to_twitter", 10, 2 );
    function add_custom_text_to_twitter ( $content, $post_id ) {
    if ( !$post_id )
    return $content;
    // Write your custom text in the field for my_custom_text post meta using post editor.
    $post_meta = get_post_meta( $post_id, 'my_custom_text', true );
    if ( $post_meta )
    return str_replace( "class='twitter-share-button'", "class='twitter-share-button' data-text='". $post_meta ."'", $content );
    else return $content;
    }

    Of course it is also possible to apply this to the other buttons, but for Facebook you can also use our Ultimate Facebook plugin.

    If you need further help, please let me know.

    Cheers,

    Hakan

    Note:

    To add a post meta (custom field), check Custom Fields of Screen Options in the post editor. Then enter the new post meta name and value under Add New Custom Field area.

    Please see attached screenshot.

  • oli_corse
    • New Recruit

    Hi,

    I think I’m having the same problem. I would like to pre-populate the Tweet with my own message.

    I have added a Custom Field called “my_custom_text” and put the Tweet I want in the Value field.

    However, when I add:

    add_filter( &quot;pwal_render_button_html&quot;, &quot;add_custom_text_to_twitter&quot;, 10, 2 );
    function add_custom_text_to_twitter ( $content, $post_id ) {
    if ( !$post_id )
    return $content;
    // Write your custom text in the field for my_custom_text post meta using post editor.
    $post_meta = get_post_meta( $post_id, 'my_custom_text', true );
    if ( $post_meta )
    return str_replace( &quot;class='twitter-share-button'&quot;, &quot;class='twitter-share-button' data-text='&quot;. $post_meta .&quot;'&quot;, $content );
    else return $content;
    }

    to the function.php file of my theme, it comes up with the following error message:

    Parse error: syntax error, unexpected ‘;’, expecting T_PAAMAYIM_NEKUDOTAYIM in /customers/1/1/b/creatrixmarketing.com/httpd.www/wp-content/themes/freestyle/functions.php on line 324

    Please can you tell me if this is what I should be doing to fill the Tweet with my own message?

    If so, what am I doing wrong?

    Many thanks

    Oli

  • oli_corse
    • New Recruit

    Hi Hakan,

    Thanks for getting back to me.

    This works OK, but it includes the Facebook Page URL (www.facebook.com/creatrixuk) in the Tweet. When I remove this from the ‘URL to be liked’ field on the Pay With A Like settings, the tweet now contains the URL for the web page (www.creatrixmarketing.com/competition), which I don’t want.

    Also, when I now click to Like the Facebook page, because I have deleted the Facebook Page URL in the ‘URL to be liked’ settings, the Like only refers to the website page as well, which I also don’t want.

    Please can you tell me how to set it up, so that the Tweet JUST contains the message I want, but also so the Facebook Page is correct.

    Many thanks

    Oli

  • Hakan
    • The Incredible Smush

    Hi Oli,

    because I have deleted the Facebook Page URL in the ‘URL to be liked’ settings

    You cannot add your Facebook page URL there at first place. Facebook will not accept it. It should be an url from your website.

    There is already an explanation about it in the settings:

    You can enter a single URL to be liked, e.g. your home page, http://example.com. NOT your page on the Social Networking Website, e.g. Facebook. If left empty, the page that button is clicked will be liked.

    So you have 3 options:

    1) Leave it empty. Then current page will be liked.

    2) Enter an url from your website (e.g. homepage), Then that page will be liked.

    3) Select random. Any published post or page will be liked.

    Please note that this will be applied to all buttons.

    Cheers,

    Hakan

  • Hakan
    • The Incredible Smush

    Which one did you use? a), b) c) ?

    This is why I couldn’t integrate this feature inside the plugin yet. There are numerous combinations.

    If we could come to a common ground, then I would have done that.

    I hope you can understand my position :slight_smile:

    Cheers,

    Hakan

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.