plugin updates
This commit is contained in:
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_About_Page' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_About_Page {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
$schema = array();
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'AboutPage';
|
||||
|
||||
$schema['mainEntityOfPage']['@type'] = 'WebPage';
|
||||
$schema['mainEntityOfPage']['@id'] = esc_url( get_permalink( $post['ID'] ) );
|
||||
|
||||
$schema['headline'] = wp_strip_all_tags( $post['post_title'] );
|
||||
$schema['description'] = BSF_AIOSRS_Pro_Schema_Template::strip_markup( $post['post_content'] );
|
||||
|
||||
$image_id = get_post_thumbnail_id( $post['ID'] );
|
||||
if ( ! empty( $image_id ) ) {
|
||||
$thumb_image = wp_get_attachment_image_src( $image_id, 'full' );
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $thumb_image );
|
||||
}
|
||||
|
||||
$settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
|
||||
if ( 'person' === $settings['site-represent'] || 'personblog' === $settings['site-represent'] ) {
|
||||
$settings['site-represent'] = 'person';
|
||||
}
|
||||
if ( 'organization' === $settings['site-represent'] || 'Webshop' === $settings['site-represent'] || 'Smallbusiness' === $settings['site-represent'] || 'Otherbusiness' === $settings['site-represent'] ) {
|
||||
$settings['site-represent'] = 'organization';
|
||||
}
|
||||
$schema['publisher']['@type'] = ( isset( $settings['site-represent'] ) && ! empty( $settings['site-represent'] ) ) ? $settings['site-represent'] : 'Organization';
|
||||
if ( 'organization' === $settings['site-represent'] ) {
|
||||
$schema['publisher']['name'] = ( isset( $settings['site-name'] ) && ! empty( $settings['site-name'] ) ) ? $settings['site-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
|
||||
} else {
|
||||
$schema['publisher']['name'] = ( isset( $settings['person-name'] ) && ! empty( $settings['person-name'] ) ) ? $settings['person-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
|
||||
}
|
||||
|
||||
$schema['publisher']['url'] = wp_strip_all_tags( get_bloginfo( 'url' ) );
|
||||
|
||||
if ( 'organization' === $settings['site-represent'] ) {
|
||||
$logo_id = get_theme_mod( 'custom_logo' );
|
||||
if ( isset( $settings['site-logo'] ) && 'custom' === $settings['site-logo'] ) {
|
||||
$logo_id = isset( $settings['site-logo-custom'] ) ? $settings['site-logo-custom'] : '';
|
||||
}
|
||||
if ( $logo_id ) {
|
||||
// Add logo image size.
|
||||
add_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
|
||||
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
|
||||
if ( isset( $logo_image[3] ) && 1 !== $logo_image[3] ) {
|
||||
BSF_AIOSRS_Pro_Schema_Template::generate_logo_by_width( $logo_id );
|
||||
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
|
||||
}
|
||||
// Remove logo image size.
|
||||
remove_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
|
||||
$schema['publisher']['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $logo_image, 'ImageObject' );
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_about_page', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Breadcrumb' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Breadcrumb {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
$schema = array();
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'BreadcrumbList';
|
||||
|
||||
$breadcrumb_list = BSF_AIOSRS_Pro_Schema_Template::get_breadcrumb_list();
|
||||
foreach ( $breadcrumb_list as $key => $breadcrumb ) {
|
||||
$schema['itemListElement'][ $key ]['@type'] = 'ListItem';
|
||||
$schema['itemListElement'][ $key ]['position'] = $key + 1;
|
||||
$schema['itemListElement'][ $key ]['item']['@id'] = esc_url( $breadcrumb['url'] );
|
||||
$schema['itemListElement'][ $key ]['item']['name'] = $breadcrumb['title'];
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_breadcrumb', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Contact_Page' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Contact_Page {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
$schema = array();
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'ContactPage';
|
||||
|
||||
$schema['mainEntityOfPage']['@type'] = 'WebPage';
|
||||
$schema['mainEntityOfPage']['@id'] = esc_url( get_permalink( $post['ID'] ) );
|
||||
|
||||
$schema['headline'] = wp_strip_all_tags( $post['post_title'] );
|
||||
$schema['description'] = BSF_AIOSRS_Pro_Schema_Template::strip_markup( $post['post_content'] );
|
||||
|
||||
$image_id = get_post_thumbnail_id( $post['ID'] );
|
||||
if ( ! empty( $image_id ) ) {
|
||||
$thumb_image = wp_get_attachment_image_src( $image_id, 'full' );
|
||||
$schema['image'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $thumb_image );
|
||||
}
|
||||
|
||||
$settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
|
||||
if ( 'person' === $settings['site-represent'] || 'personblog' === $settings['site-represent'] ) {
|
||||
$settings['site-represent'] = 'person';
|
||||
}
|
||||
if ( 'organization' === $settings['site-represent'] || 'Webshop' === $settings['site-represent'] || 'Smallbusiness' === $settings['site-represent'] || 'Otherbusiness' === $settings['site-represent'] ) {
|
||||
$settings['site-represent'] = 'organization';
|
||||
}
|
||||
$schema['publisher']['@type'] = ( isset( $settings['site-represent'] ) && ! empty( $settings['site-represent'] ) ) ? $settings['site-represent'] : 'Organization';
|
||||
if ( 'organization' === $settings['site-represent'] ) {
|
||||
$schema['publisher']['name'] = ( isset( $settings['site-name'] ) && ! empty( $settings['site-name'] ) ) ? $settings['site-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
|
||||
} else {
|
||||
$schema['publisher']['name'] = ( isset( $settings['person-name'] ) && ! empty( $settings['person-name'] ) ) ? $settings['person-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
|
||||
}
|
||||
|
||||
$schema['publisher']['url'] = wp_strip_all_tags( get_bloginfo( 'url' ) );
|
||||
|
||||
if ( 'organization' === $settings['site-represent'] ) {
|
||||
$logo_id = get_theme_mod( 'custom_logo' );
|
||||
if ( isset( $settings['site-logo'] ) && 'custom' === $settings['site-logo'] ) {
|
||||
$logo_id = isset( $settings['site-logo-custom'] ) ? $settings['site-logo-custom'] : '';
|
||||
}
|
||||
if ( $logo_id ) {
|
||||
// Add logo image size.
|
||||
add_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
|
||||
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
|
||||
if ( isset( $logo_image[3] ) && 1 !== $logo_image[3] ) {
|
||||
BSF_AIOSRS_Pro_Schema_Template::generate_logo_by_width( $logo_id );
|
||||
$logo_image = wp_get_attachment_image_src( $logo_id, 'aiosrs-logo-size' );
|
||||
}
|
||||
// Remove logo image size.
|
||||
remove_filter( 'intermediate_image_sizes_advanced', 'BSF_AIOSRS_Pro_Schema_Template::logo_image_sizes', 10, 2 );
|
||||
$schema['publisher']['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $logo_image, 'ImageObject' );
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_contact_page', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Organization' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Organization {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
$schema = array();
|
||||
$general_settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
|
||||
$social_profiles = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-social-profiles'];
|
||||
$contact_type = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-corporate-contact'];
|
||||
$contact_hear = isset( $contact_type['contact-hear'] ) ? $contact_type['contact-hear'] : '';
|
||||
$contact_toll = isset( $contact_type['contact-toll'] ) ? $contact_type['contact-toll'] : '';
|
||||
$contactpoint = array( $contact_hear, $contact_toll );
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = ( isset( $general_settings['organization'] ) && ! empty( $general_settings['organization'] ) ) ? $general_settings['organization'] : 'organization';
|
||||
$schema['name'] = ( isset( $general_settings['site-name'] ) && ! empty( $general_settings['site-name'] ) ) ? $general_settings['site-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
|
||||
$schema['url'] = wp_strip_all_tags( get_bloginfo( 'url' ) );
|
||||
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) || isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) || isset( $contact_type['contact-page-id'] ) && ! empty( $contact_type['contact-page-id'] ) ) {
|
||||
$schema['ContactPoint']['@type'] = 'ContactPoint';
|
||||
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
|
||||
if ( 'other' === $contact_type['contact-type'] ) {
|
||||
$schema ['ContactPoint']['contactType'] = $contact_type['contact-type-other'];
|
||||
} else {
|
||||
$schema ['ContactPoint']['contactType'] = $contact_type['contact-type'];
|
||||
}
|
||||
}
|
||||
if ( isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) ) {
|
||||
$schema ['ContactPoint']['telephone'] = $contact_type['telephone'];
|
||||
}
|
||||
if ( isset( $contact_type['contact-page-id'] ) && ! empty( $contact_type['contact-page-id'] ) ) {
|
||||
$page_url = get_permalink( $contact_type['contact-page-id'] );
|
||||
$schema ['ContactPoint']['url'] = $page_url;
|
||||
} else {
|
||||
$schema ['ContactPoint']['url'] = $contact_type['contact-page-id'];
|
||||
}
|
||||
if ( isset( $contact_type['email'] ) && ! empty( $contact_type['email'] ) ) {
|
||||
$schema ['ContactPoint']['email'] = $contact_type['email'];
|
||||
}
|
||||
if ( isset( $contactpoint ) && ! empty( $contactpoint ) ) {
|
||||
|
||||
$schema ['ContactPoint']['contactOption'] = $contactpoint;
|
||||
}
|
||||
if ( isset( $contact_type['areaServed'] ) && ! empty( $contact_type['areaServed'] ) ) {
|
||||
$language = explode( ',', $contact_type['areaServed'] );
|
||||
foreach ( $language as $key => $value ) {
|
||||
$schema ['ContactPoint']['areaServed'][ $key ] = wp_strip_all_tags( $value );
|
||||
}
|
||||
}
|
||||
if ( isset( $contact_type['availableLanguage'] ) && ! empty( $contact_type['availableLanguage'] ) ) {
|
||||
$language = explode( ',', $contact_type['availableLanguage'] );
|
||||
foreach ( $language as $key => $value ) {
|
||||
$schema ['ContactPoint']['availableLanguage'][ $key ] = wp_strip_all_tags( $value );
|
||||
}
|
||||
} else {
|
||||
$schema ['ContactPoint']['availableLanguage'] = 'English';
|
||||
}
|
||||
}
|
||||
|
||||
$logo_id = get_post_thumbnail_id( $post['ID'] );
|
||||
if ( isset( $general_settings['site-logo-custom'] ) ) {
|
||||
$logo_id = isset( $general_settings['site-logo-custom'] ) ? $general_settings['site-logo-custom'] : '';
|
||||
} elseif ( isset( $general_settings['site-logo'] ) && 'customizer-logo' === $general_settings['site-logo'] ) {
|
||||
if ( function_exists( 'the_custom_logo' ) && has_custom_logo() ) {
|
||||
$logo_id = get_theme_mod( 'custom_logo' );
|
||||
}
|
||||
}
|
||||
if ( $logo_id ) {
|
||||
$key = 'site-logo';
|
||||
$logo_image = BSF_AIOSRS_Pro_Schema_Template::get_image_object( $logo_id, $key );
|
||||
$schema['logo'] = BSF_AIOSRS_Pro_Schema_Template::get_image_schema( $logo_image, 'ImageObject' );
|
||||
}
|
||||
|
||||
foreach ( $social_profiles as $type => $social_link ) {
|
||||
if ( 'other' === $type && is_array( $social_link ) ) {
|
||||
foreach ( $social_link as $dynamic_social_link ) {
|
||||
if ( ! empty( $dynamic_social_link ) ) {
|
||||
$schema['sameAs'][] = $dynamic_social_link;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( ! empty( $social_link ) && ! is_array( $social_link ) ) {
|
||||
|
||||
$schema['sameAs'][] = $social_link;
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_organization', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Person' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Person {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
|
||||
$schema = array();
|
||||
$general_settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
|
||||
$social_profiles = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-social-profiles'];
|
||||
$contact_type = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-corporate-contact'];
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'Person';
|
||||
$schema['name'] = ( isset( $general_settings['person-name'] ) && ! empty( $general_settings['person-name'] ) ) ? $general_settings['person-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
|
||||
$schema['url'] = wp_strip_all_tags( get_bloginfo( 'url' ) );
|
||||
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) || isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) || isset( $contact_type['contact-page-id'] ) && ! empty( $contact_type['contact-page-id'] ) ) {
|
||||
$schema['ContactPoint']['@type'] = 'ContactPoint';
|
||||
if ( isset( $contact_type['contact-type'] ) && ! empty( $contact_type['contact-type'] ) ) {
|
||||
if ( 'other' === $contact_type['contact-type'] ) {
|
||||
$schema ['ContactPoint']['contactType'] = $contact_type['contact-type-other'];
|
||||
} else {
|
||||
$schema ['ContactPoint']['contactType'] = $contact_type['contact-type'];
|
||||
}
|
||||
}
|
||||
if ( isset( $contact_type['telephone'] ) && ! empty( $contact_type['telephone'] ) ) {
|
||||
$schema ['ContactPoint']['telephone'] = $contact_type['telephone'];
|
||||
}
|
||||
if ( isset( $contact_type['contact-page-id'] ) && ! empty( $contact_type['contact-page-id'] ) ) {
|
||||
$page_url = get_permalink( $contact_type['contact-page-id'] );
|
||||
$schema ['ContactPoint']['url'] = $page_url;
|
||||
} else {
|
||||
$schema ['ContactPoint']['url'] = $contact_type['contact-page-id'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( is_array( $social_profiles ) ) {
|
||||
foreach ( $social_profiles as $type => $social_link ) {
|
||||
if ( 'other' === $type && is_array( $social_link ) ) {
|
||||
foreach ( $social_link as $dynamic_social_link ) {
|
||||
if ( ! empty( $dynamic_social_link ) ) {
|
||||
$schema['sameAs'][] = $dynamic_social_link;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( ! empty( $social_link ) && ( ! is_array( $social_link ) ) ) {
|
||||
$schema['sameAs'][] = $social_link;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_person', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Site_Navigation_Element' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Site_Navigation_Element {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
$schema = array();
|
||||
|
||||
$names = array();
|
||||
$urls = array();
|
||||
|
||||
$settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-global-schemas'];
|
||||
if ( isset( $settings['site-navigation-element'] ) && ! empty( $settings['site-navigation-element'] ) ) {
|
||||
$navigation_links = wp_get_nav_menu_items( $settings['site-navigation-element'] );
|
||||
|
||||
if ( $navigation_links ) {
|
||||
foreach ( $navigation_links as $link ) {
|
||||
$names[] = wp_strip_all_tags( $link->title );
|
||||
$urls[] = esc_url( $link->url );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert normal array into associative array
|
||||
*/
|
||||
$combine_array = array_combine( $names, $urls );
|
||||
$new_arr[] = array();
|
||||
$j = 0;
|
||||
foreach ( $combine_array as $key => $value ) {
|
||||
$new_arr[ $j ]['name'] = $key;
|
||||
$new_arr[ $j ]['url'] = $value;
|
||||
$j++;
|
||||
}
|
||||
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
|
||||
if ( isset( $new_arr ) && ! empty( $new_arr ) ) {
|
||||
foreach ( $new_arr as $key2 => $value2 ) {
|
||||
$schema['@graph'][ $key2 ]['@context'] = 'https://schema.org';
|
||||
$schema['@graph'][ $key2 ]['@type'] = 'SiteNavigationElement';
|
||||
$schema['@graph'][ $key2 ]['id'] = 'site-navigation';
|
||||
$schema['@graph'][ $key2 ]['name'] = isset( $value2['name'] ) ? $value2['name'] : '';
|
||||
$schema['@graph'][ $key2 ]['url'] = isset( $value2['url'] ) ? $value2['url'] : '';
|
||||
}
|
||||
}
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_site_navigation_element', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Schemas Template.
|
||||
*
|
||||
* @package Schema Pro
|
||||
* @since 1.1.0
|
||||
*/
|
||||
|
||||
if ( ! class_exists( 'BSF_AIOSRS_Pro_Schema_Global_Sitelink_Search_Box' ) ) {
|
||||
|
||||
/**
|
||||
* AIOSRS Schemas Initialization
|
||||
*
|
||||
* @since 1.1.0
|
||||
*/
|
||||
class BSF_AIOSRS_Pro_Schema_Global_Sitelink_Search_Box {
|
||||
|
||||
/**
|
||||
* Render Schema.
|
||||
*
|
||||
* @param array $post Current Post Array.
|
||||
* @return array
|
||||
*/
|
||||
public static function render( $post ) {
|
||||
$schema = array();
|
||||
|
||||
$general_settings = BSF_AIOSRS_Pro_Helper::$settings['wp-schema-pro-general-settings'];
|
||||
$schema['@context'] = 'https://schema.org';
|
||||
$schema['@type'] = 'WebSite';
|
||||
$schema['name'] = ( isset( $general_settings['site-name'] ) && ! empty( $general_settings['site-name'] ) ) ? $general_settings['site-name'] : wp_strip_all_tags( get_bloginfo( 'name' ) );
|
||||
$schema['url'] = home_url();
|
||||
|
||||
$potential_action = array();
|
||||
|
||||
$template_urls = apply_filters( 'wp_schema_pro_sitelink_srearch_box_template_urls', array( site_url( '?s=' ) ) );
|
||||
foreach ( $template_urls as $template_url ) {
|
||||
$potential_action[] = array(
|
||||
'@type' => 'SearchAction',
|
||||
'target' => esc_url( $template_url ) . '{search_term_string}',
|
||||
'query-input' => 'required name=search_term_string',
|
||||
);
|
||||
}
|
||||
|
||||
$schema['potentialAction'] = $potential_action;
|
||||
|
||||
return apply_filters( 'wp_schema_pro_global_schema_sitelink_search_box', $schema, $post );
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user