extra CSS on Featured Images

Posted in: Newspaper
Post count: 22

Hi,
I’d like to add a CSS class to the featured images of all the posts on my site.
How can I do it?

Thanks

Post count: 35449

Hi,

In order to do that you need to use custom css
-> https://www.screencast.com/t/WhAOXxg5C
In this way you can add all the css on the feature class; this is the easiest way.
Also you can try to add a class with JavaScript, please check this documentation -> https://www.w3schools.com/howto/howto_js_add_class.asp

Hope this will help you!
Thanks.

Post count: 22

Hi Calin,
Thanks for your reply. That unfortunately didn’t solve the problem. Let me explain better, I need to add an extra ** CSS class ** (not additional CSS properties) to all the featured images. Javascript will not work for us, because we require web crawlers recognize this new CSS class. And as such, webcrawlers will not run the javascript, but only crawl the HTML. Perhaps you can tell me where I can edit the html where the class names are set?

May I know in what document to find the above in the editor?

Thank you

Post count: 35449

Hi,

In order to do that you need to edit the loops fro the templates you are using on your posts, for example if you are using single post template 1 you need to edit loop-single-1 , here is the path to those files wp-content/themes/Newspaper/loop-single-1.php
-> https://www.screencast.com/t/BxorAbCmn
-> https://www.screencast.com/t/Cfh0ajcXow

Hope this will help you!
Thanks.

Post count: 22

So the loop-single2.php file wasn’t displaying the featured-image tag but I found a solution editing td_module_single_base.php inside Newspaper\includes\wp_booster\td_module_single_base.php in the following code:

$buffy .= ‘<div class=”td-post-featured-image”>’;

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