Skip to content

Social Share Integration

Use PHP to create code that will populate the share data dynamically as an include on each page.

i.e. Get title from <title> description from <meta name=”description” content=”Come to X-site today! Try your skills with our ABC Product, and enter to win fun XYZ stuff!”>

Or write in manually, or leave blank for users to fill before your link and/or  tags.


Code Needed:

	<title>Your Website Title</title>
    <!-- You can use Open Graph tags to customize link previews.
    Learn more: -->
	<meta property="og:url"           content="" />
	<meta property="og:type"          content="website" />
	<meta property="og:title"         content="Your Website Title" />
	<meta property="og:description"   content="Your description" />
	<meta property="og:image"         content="" />

	<!-- Load Facebook SDK for JavaScript -->
<!-- Your share button code -->
class="fb-share-button" data-href="" data-layout="button_count">
</body> </html>

Twitter Share with custom text


Code Needed:

<a class="twitter-share-button"
text=Create Share Buttons without widgets @daniioliver" 

These code snippets are  all you need with a static or dynamically filled text property.
Link target _blank so as to not redirect from the site and of course add tracking tags.

Linkedin Share

%d bloggers like this: