-
Notifications
You must be signed in to change notification settings - Fork 63
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
base: master
Are you sure you want to change the base?
Conversation
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); |
There was a problem hiding this comment.
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.
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) { |
There was a problem hiding this comment.
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()
Defaults updated... |
Good? |
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. |
Awesome, thanks! |
Hello! Any progress here? Just want to update plugin from WP interface on my projects. |
I've updated my request with post_id check.