Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Structured Data Issues Detected Events #617

Open
hans-olson opened this issue Nov 9, 2022 · 3 comments
Open

Structured Data Issues Detected Events #617

hans-olson opened this issue Nov 9, 2022 · 3 comments
Assignees
Labels
ALPS v.3 Tickets for the ALPS v.3 development

Comments

@hans-olson
Copy link
Contributor

hans-olson commented Nov 9, 2022

Google Search Console has identified that your site is affected by 7 Events structured data issue(s). The following issues were found on your site.

Top non-critical issues**

  • Missing field "eventAttendanceMode"
  • Missing field "performer"
  • Missing field "offers"
  • Missing field "image"
  • Missing field "organizer"

**Non-critical issues are suggestions for improvement, but do not prevent the page or feature from appearing on Google. Some of these issues can affect your appearance on Search; some might be reclassified as critical issues in the future.

We recommend that you fix these issues when possible to enable the best experience and coverage in Google Search.

@hans-olson hans-olson added the ALPS v.3 Tickets for the ALPS v.3 development label Nov 9, 2022
@YauheniKapliarchuk
Copy link
Collaborator

YauheniKapliarchuk commented Sep 30, 2024

Fields:

  • organizer: General Conference of Seventh-day Adventists

@hans-olson you can fill others fields

@YauheniKapliarchuk
Copy link
Collaborator

Example of code:

add_action('wp_head', 'add_custom_event_schema');

function add_custom_event_schema() {
    if (is_singular('event')) { // Проверьте, что это страница события
        $event_attendance_mode = get_post_meta(get_the_ID(), 'event_attendance_mode', true);
        $event_performer = get_post_meta(get_the_ID(), 'event_performer', true);
        $event_ticket_url = get_post_meta(get_the_ID(), 'event_ticket_url', true);
        $event_price = get_post_meta(get_the_ID(), 'event_price', true);
        $event_currency = get_post_meta(get_the_ID(), 'event_currency', true);
        $event_image = get_the_post_thumbnail_url(get_the_ID(), 'full');
        $event_organizer = get_post_meta(get_the_ID(), 'event_organizer', true);
        $event_organizer_url = get_post_meta(get_the_ID(), 'event_organizer_url', true);

        if ($event_attendance_mode && $event_performer && $event_ticket_url && $event_price && $event_currency && $event_image && $event_organizer && $event_organizer_url) {
            ?>
            <script type="application/ld+json">
            {
                "@context": "https://schema.org",
                "@type": "Event",
                "eventAttendanceMode": "https://schema.org/<?php echo esc_html($event_attendance_mode); ?>",
                "performer": {
                    "@type": "Person",
                    "name": "<?php echo esc_html($event_performer); ?>"
                },
                "offers": {
                    "@type": "Offer",
                    "url": "<?php echo esc_url($event_ticket_url); ?>",
                    "price": "<?php echo esc_html($event_price); ?>",
                    "priceCurrency": "<?php echo esc_html($event_currency); ?>"
                },
                "image": "<?php echo esc_url($event_image); ?>",
                "organizer": {
                    "@type": "Organization",
                    "name": "<?php echo esc_html($event_organizer); ?>",
                    "url": "<?php echo esc_url($event_organizer_url); ?>"
                }
            }
            </script>
            <?php
        }
    }
}
?>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ALPS v.3 Tickets for the ALPS v.3 development
Projects
None yet
Development

No branches or pull requests

2 participants