diff --git a/includes/hooks.php b/includes/hooks.php index 6da655f..07a827d 100644 --- a/includes/hooks.php +++ b/includes/hooks.php @@ -1,42 +1,4 @@ . -function pmpro_testimonial_wp_head() { - global $post; - - // Check if the post content contains the specific shortcodes - if ( $post && ( has_shortcode( $post->post_content, 'pmpro_testimonials_display' ) || has_shortcode( $post->post_content, 'pmpro_testimonials_display_custom' ) ) ) { - // Get site title and URL - $site_title = get_bloginfo('name'); - $site_url = get_bloginfo('url'); - $schema_type = get_option( 'pmpro_testimonials_schema_type', 'Service' ); - $schema_name = sprintf( - /* translators: %s: Site title */ - __( '%s Membership', 'pmpro-testimonials' ), - get_bloginfo( 'name' ) - ); - $schema_description = get_option( 'pmpro_testimonials_schema_description' ); - if ( empty( $schema_description ) ) { - $schema_description = __( 'Access exclusive content and benefits with our memberships.', 'pmpro-testimonials' ); - } - - // Output the structured data - echo ''; - } -} -add_action( 'wp_head', 'pmpro_testimonial_wp_head' ); - // Used for the featured image block. function pmpro_testimonial_featured_image_fallback( $html, $post_id, $post_thumbnail_id, $size, $attr ) { diff --git a/includes/shortcodes/display.php b/includes/shortcodes/display.php index 3ee37ce..f2873d7 100644 --- a/includes/shortcodes/display.php +++ b/includes/shortcodes/display.php @@ -44,6 +44,19 @@ function pmpro_testimonials_display_custom( $atts, $content = '' ) { 'pmpro_testimonials_display_custom' ); + // Get data for the itemReviewed schema. + $site_title = get_bloginfo('name'); + $schema_type = 'https://schema.org/' . get_option( 'pmpro_testimonials_schema_type', 'Service' ); + $schema_name = sprintf( + /* translators: %s: Site title */ + __( '%s Membership', 'pmpro-testimonials' ), + get_bloginfo( 'name' ) + ); + $schema_description = get_option( 'pmpro_testimonials_schema_description' ); + if ( empty( $schema_description ) ) { + $schema_description = __( 'Access exclusive content and benefits with our memberships.', 'pmpro-testimonials' ); + } + $html = ''; $display = new PMPro_Testimonial_Display( $atts ); $testimonials = $display->get_testimonials(); @@ -55,6 +68,10 @@ function pmpro_testimonials_display_custom( $atts, $content = '' ) { $GLOBALS['current_pmpro_testimonial'] = $testimonial; $html .= do_shortcode( $content ); unset( $GLOBALS['current_pmpro_testimonial'] ); + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= '
'; $html .= ''; } $html .= ''; diff --git a/layouts/default.php b/layouts/default.php index b0ec478..142f6e3 100644 --- a/layouts/default.php +++ b/layouts/default.php @@ -136,5 +136,23 @@ endif; ?> + +
+ + +