| Server IP : 188.114.96.3 / Your IP : 104.23.197.71 Web Server : Apache System : Linux web236.dogado.net 4.18.0-553.141.2.lve.el7h.x86_64 #1 SMP Wed Jul 8 17:20:31 UTC 2026 x86_64 User : h193310 ( 10083) PHP Version : 8.4.12 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/h193310.web236.dogado.net/httpdocs/wp-content/themes/martfury-child/ |
Upload File : |
<?php
add_filter( "rank_math/snippet/rich_snippet_product_entity", function( $entity ) {
// Helper function to ensure array keys exist
function set_nested_array_value(&$array, $path, $value) {
$temp = &$array;
foreach ($path as $key) {
$temp = &$temp[$key];
}
$temp = $value;
}
// Helper function to create a schema section
function create_schema_section($type, $properties = []) {
$section = ['@type' => $type];
foreach ($properties as $key => $value) {
$section[$key] = $value;
}
return $section;
}
// Add return policy
$returnPolicy = create_schema_section('MerchantReturnPolicy', [
'applicableCountry' => 'DE',
'returnPolicyCategory' => 'https://schema.org/MerchantReturnFiniteReturnWindow',
'merchantReturnDays' => 14,
'returnMethod' => 'https://schema.org/ReturnByMail',
'returnFees' => 'https://schema.org/FreeReturn'
]);
set_nested_array_value($entity, ['offers', 'hasMerchantReturnPolicy'], $returnPolicy);
// Add shipping details
$shippingDetails = create_schema_section('OfferShippingDetails', [
'shippingRate' => create_schema_section('MonetaryAmount', [
'value' => 5,
'currency' => 'EUR'
]),
'shippingDestination' => create_schema_section('DefinedRegion', [
'addressCountry' => 'DE'
])
]);
$deliveryTime = create_schema_section('ShippingDeliveryTime', [
'handlingTime' => create_schema_section('QuantitativeValue', [
'minValue' => 6,
'maxValue' => 14,
'unitCode' => 'DAY'
]),
'transitTime' => create_schema_section('QuantitativeValue', [
'minValue' => 4,
'maxValue' => 5,
'unitCode' => 'DAY'
])
]);
set_nested_array_value($shippingDetails, ['deliveryTime'], $deliveryTime);
set_nested_array_value($entity, ['offers', 'shippingDetails'], $shippingDetails);
return $entity;
});
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = home_url( $_SERVER['REQUEST_URI'] );
if( (strpos($url,'?add_to_wishlist=') !== false) ) {
$robots["index"] = 'noindex';
$robots["follow"] = 'nofollow';
}
return $robots;
});
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = home_url( $_SERVER['REQUEST_URI'] );
if( (strpos($url,'?orderby=') !== false) ) {
$robots["index"] = 'noindex';
$robots["follow"] = 'nofollow';
}
return $robots;
});
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = home_url( $_SERVER['REQUEST_URI'] );
if( (strpos($url,'?add-to-cart==') !== false) ) {
$robots["index"] = 'noindex';
$robots["follow"] = 'nofollow';
}
return $robots;
});
add_filter( 'rank_math/frontend/robots', function( $robots ) {
$url = home_url( $_SERVER['REQUEST_URI'] );
if( (strpos($url,'?action=yith-woocompare-add-product') !== false) ) {
$robots["index"] = 'noindex';
$robots["follow"] = 'nofollow';
}
return $robots;
});