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.
Last edited by michilge (2017-02-07 16:15:33)
Thank you for sharing! The Twitter link works for me, but not Facebook. This is the generated link:
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
Just a user who loves to dive into techie stuff... and sometimes gets into trouble for that.
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.
Last edited by michilge (2017-02-07 07:39:50)