Support community for TTG plugins and products.
NOTICE
The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.
This forum is now closed, and exists here as a read-only archive.
You are not logged in.
In another thread I asked if it were possible to display the author and creation date in a blog post.
Rod and Matthew pointed me to creating a Wordpress child theme.
Thanks again for the help.
I now enhanced my child theme with social media sharing links that help my visitors share a link to the post in Facebook an Twitter.
This is all that I had to put into my child themes content.php (the file content.php is a modified copy of the original in the parent theme and the taxonomies-section is retyped only to identify the place where I inserted the new code):
<?php
...
// Taxonomies
echo '<p class="taxonomies">';
the_category(' ');
the_tags(' ',' ',' ');
echo '</p>';
// Social Media sharing links
$connectURL = 'https://api-ssl.bit.ly/v3/shorten?login=my_bitly_username&apiKey=my_bitly_ApiKey&longUrl='.urlencode(get_permalink()).'&format=txt';
$bitly = file_get_contents($connectURL);
?>
<p>
Share with friends:
<a target= "_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" title="Facebook"><i class="fa fa-fw fa-facebook"></i><span>Share</span></a>
<a target= "_blank" href="https://twitter.com/intent/tweet?text=Found at @kannznichkaufen: <?php echo $bitly; ?>" title="Twittern!"><i class="fa fa-fw fa-twitter"></i><span>Tweet!</span></a>
</p>
...
Of course the Twitter and Bit.ly usernames and key must be edited.
Feedback and ideas on improvement are welcome.
I post this in the support section rather than in Tips&Tricks because there might be negative implications I did not see yet.
Michael
Last edited by michilge (2017-02-07 16:15:33)
Offline
Thank you for sharing! The Twitter link works for me, but not Facebook. This is the generated link:
https://fotos.michilge.de/blog/westfalenpokal-fc-bruenninghausen-tsg-sprockhoevel-12/%20title=
I think the href argument is missing a closing quote:
<a target= "_blank" href="https://www.facebook.com/sharer/sharer.php?u=<?php the_permalink(); ?>" title="Facebook"><i class="fa fa-fw fa-facebook"></i><span>Share</span></a>
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline
Edit:
Ah got it. I hope it's better now.
Can You please check it once again.
I don't even have a FB account myself, so I did not see the mistake first.
Thank You.
Michael
Last edited by michilge (2017-02-07 07:39:50)
Offline
Now it works :-)
Daniel Leu | Photography
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com
Offline