Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Featured Image Credit but not on main page #37

Open
r-brown opened this issue Sep 17, 2018 · 4 comments
Open

Add Featured Image Credit but not on main page #37

r-brown opened this issue Sep 17, 2018 · 4 comments
Labels

Comments

@r-brown
Copy link
Member

r-brown commented Sep 17, 2018

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
Copy link
Contributor

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
Copy link
Contributor

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 r-brown added the hacktoberfest Hacktoberfest ready issue label Oct 1, 2018
@r-brown
Copy link
Member Author

r-brown commented Oct 2, 2018

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

@idea--list
Copy link
Contributor

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

@r-brown r-brown removed their assignment Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants