Here is the contents of my twitter.php include:
<?php
$tags = get_meta_tags();
echo $tags;
$dynamic_tweet_text="Episode Title by @OurCityOurStory: http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
?>
<a href="https://twitter.com/share" class="twitter-share-button" rel="canonical" data-text="<?php print $dynamic_tweet_text ?>">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
The part that reads "Episode Title" of $dynamic_tweet_text
needs to be dynamic. I need to grab it from the h1#title
.
How do I do this? It has to be done server-side due to the way Twitter's JS works and I'm not great with PHP.