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

Front page post thumbnail link title refactoring #241

Conversation

vskjefst
Copy link
Contributor

Pulled code that created title-attribute on anchor-element for the post thumbnail on the front page so that it's easier to override in the child theme.

…st thumbnail on the front page so that it's easier to override in the child theme.
@raamdev
Copy link
Owner

raamdev commented Jul 28, 2016

@vskjefst https://github.com/raamdev/independent-publisher/blob/1.7/content.php#L27 could also be refactored to use the new function.

@vskjefst
Copy link
Contributor Author

@raamdev the intention behind the method was to use it for post thumbnail title only. I use a lot of images with Creative Commons licenses, and thus wanted to easily display the license in the title. I can create a separate method for the title attribute for entry titles. Both methods can share the same code, but it will make it easier for child theme users to show different titles on post thumbnails and title headers. What do you think?

@raamdev
Copy link
Owner

raamdev commented Jul 29, 2016

the intention behind the method was to use it for post thumbnail title only

Ah, I understand now. Thanks for clarifying that (more like reiterating! I missed it the first time you mentioned it—sorry).

If you could create a separate method for entry titles and refactor those as well, that would be great.

Also, the independent_publisher_post_thumbnail_frontpage_link_title() method name should not include frontpage, as content.php is used in many other, non-front-page scenarios (e.g., archive pages).

…es to its own function. Also moved shared code to common method. It should be possible for child theme users to override title attribute values as they please now.
@vskjefst
Copy link
Contributor Author

I've pulled the remaining title attribute value code from content.php and moved it to functions.php. If there are any other files than content.php that should use this method, please let me know

@raamdev
Copy link
Owner

raamdev commented Aug 1, 2016

@vskjefst Thanks! There are just two more in functions.php that could use independent_publisher_post_link_title_common():

https://github.com/raamdev/independent-publisher/blob/1.7/functions.php#L1156

https://github.com/raamdev/independent-publisher/blob/1.7/functions.php#L1171

@vskjefst
Copy link
Contributor Author

vskjefst commented Aug 2, 2016

Done. I change the two lines so that they use independent_publisher_post_link_title(), and not the common method directly. I thought it made more sense, since it's in essence post link titles, and the common method is just there to pull out code that is shared by methods in the parent theme.

@raamdev raamdev merged commit 96b546c into raamdev:master Aug 12, 2016
@raamdev
Copy link
Owner

raamdev commented Aug 12, 2016

@vskjefst Thank you! Merged.

Next Release Changelog:

  • Enhancement: Refactored code that outputs the title="" attribute for Post Title and Post Thumbnail links. The functions independent_publisher_post_link_title() and independent_publisher_post_thumbnail_link_title() can now be easily overridden in a Child Theme. Props @vskjefst. See Issue #241.

@vskjefst vskjefst deleted the feature/post-thumbnail-front-page-link-title-function branch October 15, 2016 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants