Jump to content

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


wizzybang

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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.