WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WPSEO_Sitemap_Image_Parser::get_images() public Yoast 1.0

Get set of image data sets for the given post.

{} Это метод класса: WPSEO_Sitemap_Image_Parser{}

Возвращает

Массив.

Использование

$WPSEO_Sitemap_Image_Parser = new WPSEO_Sitemap_Image_Parser();
$WPSEO_Sitemap_Image_Parser->get_images( $post );
$post(объект) (обязательный)
Post object to get images for.

Код WPSEO_Sitemap_Image_Parser::get_images() Yoast 17.1

public function get_images( $post ) {

	$images = [];

	if ( ! is_object( $post ) ) {
		return $images;
	}

	$thumbnail_id = get_post_thumbnail_id( $post->ID );

	if ( $thumbnail_id ) {

		$src      = $this->get_absolute_url( $this->image_url( $thumbnail_id ) );
		$alt      = WPSEO_Image_Utils::get_alt_tag( $thumbnail_id );
		$title    = get_post_field( 'post_title', $thumbnail_id );
		$images[] = $this->get_image_item( $post, $src, $title, $alt );
	}

	/**
	 * Filter: 'wpseo_sitemap_content_before_parse_html_images' - Filters the post content
	 * before it is parsed for images.
	 *
	 * @param string $content The raw/unprocessed post content.
	 */
	$content = apply_filters( 'wpseo_sitemap_content_before_parse_html_images', $post->post_content );

	$unfiltered_images = $this->parse_html_images( $content );

	foreach ( $unfiltered_images as $image ) {
		$images[] = $this->get_image_item( $post, $image['src'], $image['title'], $image['alt'] );
	}

	foreach ( $this->parse_galleries( $content, $post->ID ) as $attachment ) {

		$src = $this->get_absolute_url( $this->image_url( $attachment->ID ) );
		$alt = WPSEO_Image_Utils::get_alt_tag( $attachment->ID );

		$images[] = $this->get_image_item( $post, $src, $attachment->post_title, $alt );
	}

	if ( $post->post_type === 'attachment' && wp_attachment_is_image( $post ) ) {

		$src = $this->get_absolute_url( $this->image_url( $post->ID ) );
		$alt = WPSEO_Image_Utils::get_alt_tag( $post->ID );

		$images[] = $this->get_image_item( $post, $src, $post->post_title, $alt );
	}

	foreach ( $images as $key => $image ) {

		if ( empty( $image['src'] ) ) {
			unset( $images[ $key ] );
		}
	}

	/**
	 * Filter images to be included for the post in XML sitemap.
	 *
	 * @param array $images  Array of image items.
	 * @param int   $post_id ID of the post.
	 */
	$images = apply_filters( 'wpseo_sitemap_urlimages', $images, $post->ID );

	return $images;
}