Labs64 / credit-tracker

Credit Tracker WordPress plugin
https://wordpress.org/plugins/credit-tracker/
GNU General Public License v2.0
20 stars 20 forks source link

Add Featured Image Credit but not on main page #37

Open r-brown opened 6 years ago

r-brown commented 6 years ago

Hello,

I got this to work for my featured images for individual posts but I realize that in one of my posts boxes on my main page, it shows it under the featured image thumbnails as well.

Is there a way to have the credit captions ONLY show on individual post pages?


URL: https://wordpress.org/support/topic/add-featured-image-credit-but-not-on-main-page/

idea--list commented 6 years ago

Will investigate if there is a special CSS class assigned to a featured image by WP core regardless of the theme code. If so, then the goal could be feasable with is_home() and some CSS code within creddit_tracker_thumbnail function.

idea--list commented 6 years ago

Made some investigation. Actually it might depend on the theme as well. E.g. in twentyseventeen the caption for the featured image will not be displayed on the starting page but on all other pages. In twentyfourteen the caption will be displayed for the featured image, no matter on which page you are.

Actually the solution is real easy: lets change line 214 in credit-tracker-shortcoes.php like that: if ((bool)$ct_override_caption_thumbnail and !empty($post_thumbnail_id) && !is_front_page()) { Tested and tried on 20+ themes and does the job always.

Now we still need to implement a checkbox on the settings page for turning on/off this feature.

r-brown commented 6 years ago

Hi @idea--list thank you for the suggestion. Looks good. Go ahead! 👍

idea--list commented 6 years ago

Hi @r-brown , have just sent a pull request.