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

get thumbnail title and description #103

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

350d
Copy link

@350d 350d commented Jul 6, 2016

I've updated my request with post_id check.

public static function get_post_thumbnail_title($post_type, $id) {
$post_id = get_the_ID();
$post_thumbnail_id = self::get_post_thumbnail_id($post_type, $id, $post_id);
$attachment_meta = get_post($post_thumbnail_id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! Can you check to make sure $post_thumbnail_id is valid here before doing get_post()? Making sure it is an int greater than zero should cover it. If it isn't valid, returning a blank string seems appropriate.

@350d
Copy link
Author

350d commented Jul 11, 2016

Looks good?

* @param string $id The id used to register the thumbnail.
* @return thumbnail title.
*/
public static function get_post_thumbnail_title($post_type, $id, $post_id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I didn't notice this earlier, but can you default $post_id to null so that it is an optional arg and makes sense w/the below conditional? e.g. similar to get_post_thumnail_url()

@350d
Copy link
Author

350d commented Jul 11, 2016

Defaults updated...

@350d
Copy link
Author

350d commented Jul 11, 2016

Good?

@chrisscott
Copy link
Contributor

Thanks, let me get this tested and merged. I have one other issue to address and will do a release soon here and on the .org plugins repo.

@350d
Copy link
Author

350d commented Jul 13, 2016

Awesome, thanks!

@350d
Copy link
Author

350d commented Oct 17, 2016

Hello! Any progress here? Just want to update plugin from WP interface on my projects.

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.

2 participants