• Resolved Magda

    (@prodesignerpl)


    Hello, is possible to create two types of schema. For example:
    I have blog:
    first category – kitchen – and i need to have recipe schema
    second category – painting – and i need to have CreativeWork schema

    PS. Can i disable reviews, names, emails etc? – to have only rating stars.

    Best

Viewing 1 replies (of 1 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    1. If you are assigning reviews to pages, you can set the schema type and other schema properties per-page using the Custom Fields Meta box like this: https://ww.wp.xz.cn/support/topic/product-schema-issue/#post-11620593

    If you are assigning to categories instead of to pages, you could do something like this:

    add_filter('site-reviews/schema/Recipe', function ($schema, $args) {
        $term = term_exists($args['category'], glsr()->taxonomy);
        if (empty($term['term_id'])) {
            return $schema;
        }
        $category = get_term($term['term_id'], glsr()->taxonomy);
        if ('painting' === $category->slug) {
            $schema['@type'] = 'CreativeWork';
            // add other schema properties as needed, etc.
        }
        return $schema;
    }, 10, 2);

    2. Please use the block settings to hide fields, or if using the shortcode, please see the Help > Shortcodes page to learn about the shortcode options.

Viewing 1 replies (of 1 total)

The topic ‘Schema – two types’ is closed to new replies.