The [socialrocket-tweet]
shortcode can be used to manually output a Click to Tweet in your post or page content.
You can also call a Click to Tweet via the global function social_rocket_tweet();
The shortcode accepts the following arguments (passed as an array if using the PHP function):
Argument | Default | Explanation |
quote | Text displayed on the page/post | |
tweet | Text that populates the tweet | |
include_url | global settings | Whether to include the current page/post URL in the tweet. Accepts ‘true’ or ‘false’. |
include_via | global settings | Whether to include the Twitter username in the tweet. Accepts ‘true’ or ‘false’. |
style_id | Default style | Internal ID of saved style to use, instead of the default. The ID is found in the Click to Tweet settings next to the name of each saved style. |
add_class | String of extra CSS class name(s) to include in output. | |
force_css | If ‘true’ outputs necessary CSS code inline, immediately before rendering buttons. Accepts ‘true’ or ‘false’. | |
url | Specify URL to be included if not the page where the CTT will display. | |
via | Specify @username to be included if not the one from the Social Extras settings. | |
Examples
Basic shortcode to output a Click to Tweet that shares the current page:
[socialrocket-tweet quote="This is what shows on my page or post." tweet="This is the tweet people will see on Twitter."]
Shortcode to share a different URL than the one where the Click to Tweet will display:
[socialrocket-tweet quote="This is what shows on my page or post." tweet="This is the tweet people will see on Twitter." url="https://domain.com/post-title/"]
Shortcode to use a particular style:
[socialrocket-tweet quote="This is what shows on my page or post." tweet="This is the tweet people will see on Twitter." style_id="5cce6030bc38d"]