Skip to content

Commit

Permalink
feat: add caption method to Image
Browse files Browse the repository at this point in the history
  • Loading branch information
nilssonpeter committed Jan 31, 2020
1 parent 2b9862e commit 55242e4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/DataTypes/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,14 @@ public function description()
}
return $meta->post_content;
}

public function caption()
{
$caption = $this->wp->wp_get_attachment_caption($this->id);
if (!$caption) {
return false;
}

return $caption;
}
}

0 comments on commit 55242e4

Please sign in to comment.