| @@ -1,7 +1,7 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | /** |
| 3 | - * Templates plugin functions | |
| 3 | + * Templates plugin functions. | |
| 4 | 4 | * |
| 5 | 5 | * @package sharing-image |
| 6 | 6 | * @author Anton Lukin |
| 7 | 7 | */ |
| @@ -13,23 +13,26 @@ | ||
| 13 | 13 | if ( ! function_exists( 'sharing_image_poster' ) ) { |
| 14 | 14 | /** |
| 15 | 15 | * Public function to get Sharing Image poster url. |
| 16 | 16 | * |
| 17 | - * @param int $object_id Optional. Post ID or Taxonomy term ID. | |
| 17 | + * @param int $object_id Optional. Post ID or Taxonomy term ID. | |
| 18 | + * @param string $object_type Optional. Requested meta type, can be singular or taxonomy. | |
| 19 | + * Default is determined by the type of the template in which it is called. | |
| 18 | 20 | */ |
| 19 | - function sharing_image_poster( $object_id = null ) { | |
| 20 | - return ( new Sharing_Image\Meta() )->get_poster( $object_id ); | |
| 21 | + function sharing_image_poster( $object_id = null, $object_type = null ) { | |
| 22 | + return Sharing_Image\Meta::get_poster( $object_id, $object_type ); | |
| 21 | 23 | } |
| 22 | 24 | } |
| 23 | 25 | |
| 24 | - | |
| 25 | 26 | if ( ! function_exists( 'sharing_image_poster_src' ) ) { |
| 26 | 27 | /** |
| 27 | 28 | * Public function to get Sharing Image poster data. |
| 28 | 29 | * Return image url, width and height. |
| 29 | 30 | * |
| 30 | - * @param int $object_id Optional. Post ID or Taxonomy term ID. | |
| 31 | + * @param int $object_id Optional. Post ID or Taxonomy term ID. | |
| 32 | + * @param string $object_type Optional. Requested meta type, can be singular or taxonomy. | |
| 33 | + * Default is determined by the type of the template in which it is called. | |
| 31 | 34 | */ |
| 32 | - function sharing_image_poster_src( $object_id = null ) { | |
| 33 | - return ( new Sharing_Image\Meta() )->get_poster_src( $object_id ); | |
| 35 | + function sharing_image_poster_src( $object_id = null, $object_type = null ) { | |
| 36 | + return Sharing_Image\Meta::get_poster_src( $object_id, $object_type ); | |
| 34 | 37 | } |
| 35 | 38 | } |