Insert code after the featured image

Posted in: Newspaper
Post count: 16

hi TagDiv,

hope you’re well!

Thanks for this awesome theme, you rock 🙂

Just a quick one … I want to be able to automatically have the following code inserted (without me having to do it manually) after the featured image on every post in a certain category or tag, or by a certain author:

Follow @renailemay
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script>

Is there a way to be able to do this?

Any help would be very much appreciated, I’ve been puzzling on this for ages 😉

Kind regards,

Renai LeMay

Post count: 22421

Hello,
If you wish to add a piece of code to a certain place automatically in the theme, you will need to edit the specific files corresponding to every place you want the widget to appear.
For example, if you want it to appear on posts, you will have to add it in the post template files here: http://screencast.com/t/90Lz9pLmZD . For every post template you use, you will have to add the code in the corresponding file. Then if you only want to show the widget in a particular category, then you can add conditionals to your code like so:
<?php if (in_category('your category name')){
as a reference: https://developer.wordpress.org/reference/functions/in_category/
I hope this helps.
Thanks.

Post count: 16

No worries, thanks for the help!

Renai

Viewing 3 posts - 1 through 3 (of 3 total)
The forum ‘Newspaper’ is closed to new topics and replies.