Jump to content

Need help with the way a tweet is constructed thhrough a tweet share button.


Recommended Posts

 

I am looking to change the way a tweet is constructed using a share button on my website. I have tried to change it but either breaks the page or the tweet is missing parts. The tweet is currently constructed like this:

 

Ralf Little Destroys Jeremy Hunts Lies On The Andrew Marr Show via @username https://******.com/ralf-little-destroys-jeremy-hunts-lies-andrew-marr-show/

 

However, I would like it to be like this with the via @username being presented at the end of the tweet: 

 

Ralf Little Destroys Jeremy Hunts Lies On The Andrew Marr Show https://******.com/ralf-little-destroys-jeremy-hunts-lies-andrew-marr-show/ via @username

 

 

The PHP code below is how the tweet is being contructed:

'twitter' => array(
'url' => 'https://twitter.com/intent/tweet?text='. $post_title . $share_twitter_username .'&url='. $post_link,
'text' => esc_html__( 'Twitter', 'jannah' ),
),

This is the code for the $share_twitter_username part which is the part I would like moving to the end:

$share_twitter_username = jannah_get_option( 'share_twitter_username' ) ? ' via %40'.jannah_get_option( 'share_twitter_username' ) : '';

As mentioned, I've not been able to do it as it either breaks the whole page or parts of the tweet are missing.

Edited by wizzybang
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.