Commit realizado el 12:13:52 08-04-2024
This commit is contained in:
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - course
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Schema
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$shortcode->get_description( $schema['claimReviewed'] );
|
||||
$shortcode->get_image();
|
||||
|
||||
?>
|
||||
<div class="rank-math-review-data">
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'URL', 'rank-math-pro' ),
|
||||
'url'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Author Name', 'rank-math-pro' ),
|
||||
'itemReviewed.author.name'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Published Date', 'rank-math-pro' ),
|
||||
'itemReviewed.datePublished'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Appearance Headline', 'rank-math-pro' ),
|
||||
'itemReviewed.appearance.headline'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Appearance URL', 'rank-math-pro' ),
|
||||
'itemReviewed.appearance.url'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Appearance Author', 'rank-math-pro' ),
|
||||
'itemReviewed.appearance.author.name'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Appearance Published Date', 'rank-math-pro' ),
|
||||
'itemReviewed.appearance.datePublished'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Alternate Name', 'rank-math-pro' ),
|
||||
'reviewRating.alternateName'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php $shortcode->show_ratings( 'reviewRating.ratingValue' ); ?>
|
||||
</div>
|
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - course
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Schema
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$shortcode->get_title();
|
||||
$shortcode->get_image();
|
||||
|
||||
?>
|
||||
<div class="rank-math-review-data">
|
||||
|
||||
<?php $shortcode->get_description(); ?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'URL', 'rank-math-pro' ),
|
||||
'url'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Reference Web page ', 'rank-math-pro' ),
|
||||
'sameAs'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$identifier = $shortcode->get_field_value( 'identifier' );
|
||||
if ( ! empty( $identifier ) ) {
|
||||
$identifiers = explode( PHP_EOL, $identifier );
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Identifier', 'rank-math-pro' ),
|
||||
'<ul><li>' . join( '</li><li>', $identifiers ) . '</li></ul>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$keyword = $shortcode->get_field_value( 'keywords' );
|
||||
if ( ! empty( $keyword ) ) {
|
||||
$keywords = explode( PHP_EOL, $keyword );
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Keywords', 'rank-math-pro' ),
|
||||
'<ul><li>' . join( '</li><li>', $keywords ) . '</li></ul>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'License', 'rank-math-pro' ),
|
||||
'license'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Catalog', 'rank-math-pro' ),
|
||||
'includedInDataCatalog.name'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Temporal Coverage', 'rank-math-pro' ),
|
||||
'temporalCoverage'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Special Coverage', 'rank-math-pro' ),
|
||||
'spatialCoverage'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$data_sets = $shortcode->get_field_value( 'hasPart' );
|
||||
$labels = [
|
||||
'name' => esc_html__( 'Name', 'rank-math-pro' ),
|
||||
'description' => esc_html__( 'Description', 'rank-math-pro' ),
|
||||
'license' => esc_html__( 'License', 'rank-math-pro' ),
|
||||
];
|
||||
if ( ! empty( $data_sets ) ) {
|
||||
echo '<h3>' . esc_html__( 'Data Sets', 'rank-math-pro' ) . '</h3>';
|
||||
foreach ( $data_sets as $data_set ) {
|
||||
echo '<div>';
|
||||
foreach ( $labels as $key => $label ) {
|
||||
echo "<p><strong>{$label}</strong>: {$data_set[$key]}</p>"; // phpcs:ignore
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$distributions = $shortcode->get_field_value( 'distribution' );
|
||||
$labels = [
|
||||
'encodingFormat' => esc_html__( 'Format', 'rank-math-pro' ),
|
||||
'contentUrl' => esc_html__( 'URL', 'rank-math-pro' ),
|
||||
];
|
||||
if ( ! empty( $distributions ) ) {
|
||||
echo '<h3>' . esc_html__( 'Distribution', 'rank-math-pro' ) . '</h3>';
|
||||
foreach ( $distributions as $distribution ) {
|
||||
echo '<div>';
|
||||
foreach ( $labels as $key => $label ) {
|
||||
echo "<p><strong>{$label}</strong>: {$distribution[$key]}</p>"; // phpcs:ignore
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - FAQPage
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Schema
|
||||
*/
|
||||
|
||||
use RankMath\Schema\Block_FAQ;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( empty( $schema['mainEntity'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$attributes = [
|
||||
'questions' => [],
|
||||
'listStyle' => '',
|
||||
'titleWrapper' => 'h3',
|
||||
'sizeSlug' => 'thumbnail',
|
||||
'listCssClasses' => '',
|
||||
'titleCssClasses' => '',
|
||||
'contentCssClasses' => '',
|
||||
'textAlign' => 'left',
|
||||
];
|
||||
|
||||
foreach ( $schema['mainEntity'] as $index => $main_entity ) {
|
||||
$attributes['questions'][] = [
|
||||
'id' => 'faq-' . ( $index + 1 ),
|
||||
'title' => $main_entity['name'],
|
||||
'content' => $main_entity['acceptedAnswer']['text'],
|
||||
'visible' => 1,
|
||||
'imageID' => 0,
|
||||
'imageUrl' => isset( $main_entity['image'] ) ? $main_entity['image'] : '',
|
||||
];
|
||||
}
|
||||
|
||||
echo Block_FAQ::markup( $attributes ); // phpcs:ignore
|
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - HowTo
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Schema
|
||||
*/
|
||||
|
||||
use RankMath\Schema\Block_HowTo;
|
||||
use RankMath\Helpers\WordPress;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$has_duration = false;
|
||||
$days = 0;
|
||||
$hours = 0;
|
||||
$minutes = 0;
|
||||
if ( isset( $schema['totalTime'] ) && WordPress::get_formatted_duration( $schema['totalTime'] ) ) {
|
||||
$has_duration = true;
|
||||
$duration = new \DateInterval( $schema['totalTime'] );
|
||||
$days = $duration->d;
|
||||
$hours = $duration->h;
|
||||
$minutes = $duration->i;
|
||||
}
|
||||
|
||||
$attributes = [
|
||||
'days' => $days,
|
||||
'hours' => $hours,
|
||||
'minutes' => $minutes,
|
||||
'hasDuration' => $has_duration,
|
||||
'material' => isset( $schema['material'] ) ? $schema['material'] : '',
|
||||
'imageUrl' => isset( $schema['image']['url'] ) ? $schema['image']['url'] : '',
|
||||
'description' => isset( $schema['description'] ) ? $schema['description'] : '',
|
||||
'estimatedCost' => isset( $schema['estimatedCost']['value'] ) ? $schema['estimatedCost']['value'] : '',
|
||||
'estimatedCostCurrency' => isset( $schema['estimatedCost']['currency'] ) ? $schema['estimatedCost']['currency'] : '',
|
||||
'steps' => [],
|
||||
'supply' => '',
|
||||
'tools' => '',
|
||||
];
|
||||
|
||||
if ( ! empty( $schema['step'] ) ) {
|
||||
foreach ( $schema['step'] as $step ) {
|
||||
$attributes['steps'][] = [
|
||||
'visible' => 1,
|
||||
'title' => $step['name'],
|
||||
'imageUrl' => $step['image']['url'],
|
||||
'content' => $step['itemListElement']['text'],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $schema['supply'] ) ) {
|
||||
foreach ( $schema['supply'] as $supply ) {
|
||||
$attributes['supply'] .= $supply['name'] . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! empty( $schema['tool'] ) ) {
|
||||
foreach ( $schema['tool'] as $tool ) {
|
||||
$attributes['tools'] .= $tool['name'] . PHP_EOL;
|
||||
}
|
||||
}
|
||||
|
||||
// No steps.
|
||||
if ( empty( $attributes['steps'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
echo Block_HowTo::markup( $attributes ); // phpcs:ignore
|
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - Job Posting
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Schema
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$shortcode->get_title();
|
||||
$shortcode->get_image();
|
||||
?>
|
||||
<div class="rank-math-review-data">
|
||||
|
||||
<?php $shortcode->get_description(); ?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Salary', 'rank-math-pro' ),
|
||||
'baseSalary.value.value'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Salary Currency', 'rank-math-pro' ),
|
||||
'baseSalary.currency'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Payroll', 'rank-math-pro' ),
|
||||
'baseSalary.value.unitText'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Date Posted', 'rank-math-pro' ),
|
||||
'datePosted'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Posting Expiry Date', 'rank-math-pro' ),
|
||||
'validThrough'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Unpublish when expired', 'rank-math-pro' ),
|
||||
'unpublish'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Employment Type ', 'rank-math-pro' ),
|
||||
'employmentType'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Hiring Organization ', 'rank-math-pro' ),
|
||||
'hiringOrganization.name'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Organization URL', 'rank-math-pro' ),
|
||||
'hiringOrganization.sameAs'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Organization Logo', 'rank-math-pro' ),
|
||||
'hiringOrganization.logo'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Job Type', 'rank-math-pro' ),
|
||||
'jobLocationType'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$locations = $shortcode->get_field_value( 'applicantLocationRequirements' );
|
||||
if ( ! empty( $locations ) ) {
|
||||
$locations = array_map(
|
||||
function( $location ) {
|
||||
return ! empty( $location['name'] ) ? $location['name'] : '';
|
||||
},
|
||||
$locations
|
||||
);
|
||||
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Job Location', 'rank-math-pro' ),
|
||||
'<ul><li>' . join( '</li><li>', $locations ) . '</li></ul>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Location', 'rank-math-pro' ),
|
||||
'jobLocation.address'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$education = $shortcode->get_field_value( 'educationRequirements' );
|
||||
if ( is_array( $education ) && ! empty( $education ) ) {
|
||||
$education = array_map(
|
||||
function( $credential ) {
|
||||
return ! empty( $credential['credentialCategory'] ) ? ucwords( $credential['credentialCategory'] ) : '';
|
||||
},
|
||||
$education
|
||||
);
|
||||
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Education Required', 'rank-math-pro' ),
|
||||
'<ul><li>' . join( '</li><li>', $education ) . '</li></ul>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$experience = $shortcode->get_field_value( 'experienceRequirements' );
|
||||
if ( is_array( $experience ) && ! empty( $experience['monthsOfExperience'] ) ) {
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Experience Required', 'rank-math-pro' ),
|
||||
$experience['monthsOfExperience'] . ' ' . esc_html__( 'Months', 'rank-math-pro' )
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
</div>
|
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - Movie
|
||||
*
|
||||
* @package RankMath
|
||||
* @subpackage RankMath\Schema
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$shortcode->get_title();
|
||||
$shortcode->get_image();
|
||||
|
||||
?>
|
||||
<div class="rank-math-review-data">
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Director', 'rank-math-pro' ),
|
||||
'director'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Date Created', 'rank-math-pro' ),
|
||||
'dateCreated',
|
||||
true
|
||||
);
|
||||
?>
|
||||
|
||||
<?php $shortcode->show_ratings(); ?>
|
||||
</div>
|
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - PodcastEpisode
|
||||
*
|
||||
* @since 3.0.17
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Schema
|
||||
*/
|
||||
|
||||
use RankMath\Helpers\WordPress;
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
if ( empty( $schema['associatedMedia'] ) || empty( $schema['associatedMedia']['contentUrl'] ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
$post_title = get_the_title( $post->ID );
|
||||
$episode_title = $schema['name'];
|
||||
if ( $schema['name'] === $post_title && $post->ID === get_the_ID() ) {
|
||||
$episode_title = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Filter: 'rank_math/schema/podcast_episode_title' - Allow changing the title of the podcast episode. Pass false to disable.
|
||||
*
|
||||
* @var string $post_title The title of the podcast episode.
|
||||
*
|
||||
* @param WP_Post $post The post object.
|
||||
* @param array $schema The schema array.
|
||||
*/
|
||||
$episode_title = apply_filters( 'rank_math/schema/podcast_episode_title', $episode_title, $post, $schema );
|
||||
|
||||
$season = ! empty( $schema['partOfSeason'] ) ? $schema['partOfSeason'] : [];
|
||||
$time_required = [];
|
||||
if ( isset( $schema['timeRequired'] ) && WordPress::get_formatted_duration( $schema['timeRequired'] ) ) {
|
||||
$duration = new \DateInterval( $schema['timeRequired'] );
|
||||
$time_required[] = ! empty( $duration->h ) ? sprintf( esc_html__( '%d Hour', 'rank-math-pro' ), $duration->h ) : '';
|
||||
$time_required[] = ! empty( $duration->i ) ? sprintf( esc_html__( '%d Min', 'rank-math-pro' ), $duration->i ) : '';
|
||||
$time_required[] = ! empty( $duration->s ) ?sprintf( esc_html__( '%d Sec', 'rank-math-pro' ), $duration->s ) : '';
|
||||
$time_required = array_filter( $time_required );
|
||||
}
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<!-- wp:columns -->
|
||||
<div class="wp-block-columns" style="gap: 2em;">
|
||||
<!-- wp:column -->
|
||||
<?php if ( ! empty( $schema['thumbnailUrl'] ) ) {
|
||||
$image_id = attachment_url_to_postid( $schema['thumbnailUrl'] );
|
||||
$img = '<img src="' . esc_url( $schema['thumbnailUrl'] ) . '" />';
|
||||
|
||||
if ( $image_id ) {
|
||||
$img = wp_get_attachment_image( $image_id, 'medium', false, [ 'class' => 'wp-image-' . $image_id ] );
|
||||
}
|
||||
?>
|
||||
<div class="wp-block-column" style="flex: 0 0 25%;">
|
||||
<!-- wp:image -->
|
||||
<figure class="wp-block-image size-medium is-resized">
|
||||
<?php echo wp_kses_post( $img ); ?>
|
||||
</figure>
|
||||
<!-- /wp:image -->
|
||||
</div>
|
||||
<!-- /wp:column -->
|
||||
<?php } ?>
|
||||
|
||||
<!-- wp:column -->
|
||||
<div class="wp-block-column">
|
||||
<!-- wp:paragraph -->
|
||||
<p>
|
||||
<?php if ( ! empty( $schema['datePublished'] ) ) { ?>
|
||||
<span class="rank-math-podcast-date">
|
||||
<?php echo esc_html( date( "j F", strtotime( $schema['datePublished'] ) ) ); ?>
|
||||
</span> ·
|
||||
<?php } ?>
|
||||
<span>
|
||||
<?php if ( ! empty( $season['seasonNumber'] ) ) { ?>
|
||||
<?php echo esc_html__( 'Season', 'rank-math-pro' ); ?> <?php echo esc_html( $season['seasonNumber'] ); ?>
|
||||
<?php if ( ! empty( $season['name'] ) ) { ?>
|
||||
: <?php if ( ! empty( $season['url'] ) ) { ?>
|
||||
<a href="<?php echo esc_url( $season['url'] ); ?>"><?php echo esc_html( $season['name'] ); ?></a>
|
||||
<?php } else { ?>
|
||||
<?php echo esc_html( $season['name'] ); ?>
|
||||
<?php } ?>
|
||||
<?php } ?> ·
|
||||
<?php } ?>
|
||||
|
||||
<?php if ( ! empty( $schema['episodeNumber'] ) ) { ?>
|
||||
<?php echo esc_html__( 'Episode', 'rank-math-pro' ); ?> <?php echo esc_html( $schema['episodeNumber'] ); ?>
|
||||
<?php } ?>
|
||||
</span>
|
||||
</p>
|
||||
<!-- /wp:paragraph -->
|
||||
|
||||
<?php if ( $episode_title ) { ?>
|
||||
<!-- wp:heading -->
|
||||
<h2>
|
||||
<?php echo esc_html( $episode_title ); ?>
|
||||
</h2>
|
||||
<!-- /wp:heading -->
|
||||
<?php } ?>
|
||||
|
||||
<!-- wp:paragraph -->
|
||||
<p>
|
||||
<?php if ( ! empty( $time_required ) ) { ?>
|
||||
<span>
|
||||
<?php echo implode( ', ', $time_required ); ?>
|
||||
</span>
|
||||
·
|
||||
<?php } ?>
|
||||
<?php if ( ! empty( $schema['author'] ) ) { ?>
|
||||
<?php echo esc_html__( 'By', 'rank-math-pro' ); ?> <?php echo esc_html( $schema['author']['name'] ); ?>
|
||||
<?php } ?>
|
||||
</p>
|
||||
<!-- /wp:paragraph -->
|
||||
</div>
|
||||
<!-- /wp:column -->
|
||||
</div>
|
||||
<!-- /wp:columns -->
|
||||
<!-- wp:audio -->
|
||||
<figure class="wp-block-audio">
|
||||
<audio controls src="<?php echo esc_url( $schema['associatedMedia']['contentUrl'] ); ?>"></audio>
|
||||
</figure>
|
||||
<!-- /wp:audio -->
|
||||
|
||||
<?php if ( ! empty( $schema['description'] ) ) { ?>
|
||||
<!-- wp:paragraph -->
|
||||
<p><?php echo esc_html( $schema['description'] ); ?></p>
|
||||
<!-- /wp:paragraph -->
|
||||
<?php } ?>
|
||||
<?php
|
||||
|
||||
echo do_blocks( ob_get_clean() );
|
@@ -0,0 +1,89 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - Product
|
||||
*
|
||||
* @since 2.7.0
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Schema
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$shortcode->get_title();
|
||||
$shortcode->get_image();
|
||||
|
||||
$offers = $shortcode->get_field_value( 'offers' );
|
||||
$positive_notes = $shortcode->get_field_value( 'review.positiveNotes' );
|
||||
$negative_notes = $shortcode->get_field_value( 'review.negativeNotes' );
|
||||
?>
|
||||
<div class="rank-math-review-data">
|
||||
|
||||
<?php $shortcode->get_description(); ?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Product SKU', 'rank-math-pro' ),
|
||||
'sku'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$brand = $shortcode->get_field_value( 'brand' );
|
||||
if ( ! empty( $brand['url'] ) && ! empty( $brand['name'] ) ) {
|
||||
?>
|
||||
<p>
|
||||
<strong><?php echo esc_html__( 'Product Brand', 'rank-math-pro' ); ?>: </strong>
|
||||
<a href="<?php echo esc_url( $brand['url'] ); ?>"><?php echo esc_html( $brand['name'] ); ?></a>
|
||||
</p>
|
||||
<?php
|
||||
} else {
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Product Brand', 'rank-math-pro' ),
|
||||
'brand.name'
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (
|
||||
! empty( $offers['price'] ) ||
|
||||
(
|
||||
empty( $positive_notes ) &&
|
||||
empty( $negative_notes )
|
||||
)
|
||||
) {
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Product Currency', 'rank-math-pro' ),
|
||||
'offers.priceCurrency'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Product Price', 'rank-math-pro' ),
|
||||
'offers.price'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Price Valid Until', 'rank-math-pro' ),
|
||||
'offers.priceValidUntil'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Product In-Stock', 'rank-math-pro' ),
|
||||
'offers.availability'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<?php $shortcode->show_ratings(); ?>
|
||||
|
||||
</div>
|
@@ -0,0 +1,186 @@
|
||||
<?php
|
||||
/**
|
||||
* Shortcode - Recipe
|
||||
*
|
||||
* @package RankMathPro
|
||||
* @subpackage RankMathPro\Schema
|
||||
*/
|
||||
|
||||
defined( 'ABSPATH' ) || exit;
|
||||
|
||||
$shortcode->get_title();
|
||||
$shortcode->get_image();
|
||||
?>
|
||||
<div class="rank-math-review-data">
|
||||
|
||||
<?php $shortcode->get_description(); ?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Type', 'rank-math-pro' ),
|
||||
'recipeCategory'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Cuisine', 'rank-math-pro' ),
|
||||
'recipeCuisine'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Keywords', 'rank-math-pro' ),
|
||||
'keywords'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Recipe Yield', 'rank-math-pro' ),
|
||||
'recipeYield'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Calories', 'rank-math-pro' ),
|
||||
'nutrition.calories'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Preparation Time', 'rank-math-pro' ),
|
||||
'prepTime'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Cooking Time', 'rank-math-pro' ),
|
||||
'cookTime'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Total Time', 'rank-math-pro' ),
|
||||
'totalTime'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Recipe Video Name', 'rank-math-pro' ),
|
||||
'video.name'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Recipe Video Description', 'rank-math-pro' ),
|
||||
'video.description'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Recipe Video Thumbnail', 'rank-math-pro' ),
|
||||
'video.thumbnailUrl'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$videoembed = $shortcode->get_field_value( 'video' );
|
||||
if ( ! empty( $videoembed ) ) {
|
||||
global $wp_embed;
|
||||
if ( ! empty( $videoembed['embedUrl'] ) ) {
|
||||
echo do_shortcode( $wp_embed->autoembed( $videoembed['embedUrl'] ) );
|
||||
} elseif ( ! empty( $videoembed['contentUrl'] ) ) {
|
||||
echo do_shortcode( $wp_embed->autoembed( $videoembed['contentUrl'] ) );
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php
|
||||
$ingredient = $shortcode->get_field_value( 'recipeIngredient' );
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Recipe Ingredients', 'rank-math-pro' ),
|
||||
'<ul><li>' . join( '</li><li>', $ingredient ) . '</li></ul>'
|
||||
);
|
||||
?>
|
||||
|
||||
<?php
|
||||
$instructions = $shortcode->get_field_value( 'recipeInstructions' );
|
||||
if ( is_string( $instructions ) ) {
|
||||
$shortcode->get_field(
|
||||
esc_html__( 'Recipe Instructions', 'rank-math-pro' ),
|
||||
'recipeInstructions'
|
||||
);
|
||||
} else {
|
||||
// HowTo Array.
|
||||
if ( isset( $instructions[0]['@type'] ) && 'HowtoStep' === $instructions[0]['@type'] ) {
|
||||
$instructions = wp_list_pluck( $instructions, 'text' );
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Recipe Instructions', 'rank-math-pro' ),
|
||||
'<ul><li>' . join( '</li><li>', $instructions ) . '</li></ul>'
|
||||
);
|
||||
}
|
||||
|
||||
// Single HowToSection data.
|
||||
if ( ! empty( $instructions['itemListElement'] ) ) {
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Recipe Instructions', 'rank-math-pro' ),
|
||||
''
|
||||
);
|
||||
|
||||
$shortcode->output_field(
|
||||
$instructions['name'],
|
||||
'<ul><li>' . join( '</li><li>', wp_list_pluck( $instructions['itemListElement'], 'text' ) ) . '</li></ul>'
|
||||
);
|
||||
}
|
||||
|
||||
// Multiple HowToSection data.
|
||||
if ( isset( $instructions[0]['@type'] ) && 'HowToSection' === $instructions[0]['@type'] ) {
|
||||
$shortcode->output_field(
|
||||
esc_html__( 'Recipe Instructions', 'rank-math-pro' ),
|
||||
''
|
||||
);
|
||||
|
||||
foreach ( $instructions as $section ) {
|
||||
if ( empty( $section['itemListElement'] ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$data = '';
|
||||
foreach ( $section['itemListElement'] as $item ) {
|
||||
$url = ! empty( $item['url'] ) ? $item['url'] : '';
|
||||
$name = ! empty( $item['name'] ) ? $item['name'] : '';
|
||||
$image = ! empty( $item['image'] ) ? $item['image']['url'] : '';
|
||||
$text = ! empty( $item['text'] ) ? $item['text'] : '';
|
||||
|
||||
$data .= '<div class="inner-wrapper">';
|
||||
$data .= '<div class="content-wrapper">';
|
||||
$data .= '<h5><a href="' . esc_url( $url ) . '" target="_blank">' . esc_html__( $name ) . '</a></h5>';
|
||||
$data .= '<p>' . esc_html( $text ) . '</p>';
|
||||
$data .= '</div>';
|
||||
$data .= '<img src="' . esc_url( $image ) . '" />';
|
||||
$data .= '</div>';
|
||||
}
|
||||
|
||||
echo '<div class="recipe-instructions-data">';
|
||||
$shortcode->output_field(
|
||||
$section['name'],
|
||||
$data
|
||||
);
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<?php $shortcode->show_ratings(); ?>
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user