Trying To Get “Review” to show up in Product section of Schema
-
Hello,
Love the plugin, and am just trying to see if it could possibly handle additional issues I’m having. Specifically, I’m trying to find a way to not get the warnings for:
The review field is recommended. Please provide a value if available.
The offers field is recommended. Please provide a value if available.I don’t do offers, so that makes sense as an error. However, the review field issue perplexes me.
The page I need help with: [log in to see the link]
-
Question #2: Are you using Site Reviews to allow your readers to review the films and TV series that you have written review articles about?
If yes, then you should use the “Film” and “TVSeries” schema types as your custom schema type as suggested previously.
–
How much of this can be automated or do I manually have to enter the fields from Schema.org?First choose one of them as your custom schema type in the settings. Then on each of the pages that needs a different type, use the Custom Fields meta box that WordPress provides and add a new field with the name of
schema_type
and the value of the schema type that you want to apply to the page (i.e. TVSeries). Note that the value is case sensitive.TVSeries
will work,tvseries
will not (see the screenshot from one of the previous replies).- This reply was modified 4 years, 6 months ago by Gemini Labs.
This could also be automated. Do you already set a TV or Movie category on each page?
First, let me thank you again for your patience.
–
I tried it and it worked!Now, in terms of automation, I was wondering, do you think I should make the default “CreativeWork” and then specify in each post what it specifically is?
Also, I do categorize everything. The breakdown is Movies, Books, TV Series, a few others, like Character Guides and Collected Quotes, I’m not sure if I should leave under creative work or make articles
Now, in terms of automation, I was wondering, do you think I should make the default “CreativeWork” and then specify in each post what it specifically is?
That can work.
Also, I do categorize everything. The breakdown is Movies, Books, TV Series, a few others, like Character Guides and Collected Quotes, I’m not sure if I should leave under creative work or make articles
If you use “CreativeWork” as the default schema type, then you could use the
site-reviews/schema/CreativeWork
filter hook to automate everything.Something like this: https://pastebin.com/qdsZx4mm
Once you have done that and if any of the custom schema types need additional properties than those provided by Site Reviews, you can use the method outlined here using the Custom Fields metabox to add them (changing the filter hook name obviously to match the custom schema type): https://www.ads-software.com/support/topic/product-schema-issue/#post-11620593
For example, to add the publisher of a game to the Game schema:
add_filter('site-reviews/schema/Game', function ($schema) { $postId = get_the_ID(); $schema['publisher'] = get_post_meta($postId, 'schema_publisher', true); return $schema; });
Just to check, since I don’t do code, is this alright?
If “Character Guides”, “Non-Reviews”, and “Collected Quotes” are all names of existing categories, then yes.
You may also change “Game” to “VideoGame”.
- This reply was modified 4 years, 6 months ago by Gemini Labs.
Awesome. Now, for “Invalid object type for field “itemReviewed”” is there anyway to fix that? Am I missing something? Is that associated with anything in the site_reviews_form?
Following the above link, I tried this:
add_filter(‘site-reviews/schema/Review’, function( $schema ) {
$postId = get_the_ID();
$schema[‘itemReviewed’] = get_post_meta( $postId, ‘schema_itemReviewed’, true );
return $schema;
});add_filter(‘site-reviews/schema/Review’, function( $schema ) {
$postId = get_the_ID();
$schema[‘itemReviewed’] = get_post_meta( $postId, ‘schema_itemReviewed’, true );
return $schema;
});add_filter(‘site-reviews/schema/AggregateRating’, function( $schema ) {
$postId = get_the_ID();
$schema[‘itemReviewed’] = get_post_meta( $postId, ‘schema_itemReviewed’, true );
return $schema;
});Should I just leave well enough alone?
The Site Reviews schema filter hook will only work for the main schema type of your page. For example:
This will not work!
add_filter('site-reviews/schema/AggregateRating', function ($schema) { $postId = get_the_ID(); $schema['itemReviewed'] = get_post_meta($postId, 'schema_itemReviewed', true); return $schema; });
But this will work
add_filter('site-reviews/schema/TVSeries', function ($schema) { $postId = get_the_ID(); $schema['itemReviewed'] = get_post_meta( $postId, 'schema_itemReviewed', true ); return $schema; });
And this will also work
add_filter('site-reviews/schema/TVSeries', function ($schema) { unset($schema['aggregateRating']); return $schema; });
It also will not work for schema that it did not generate (i.e. Review)! As mentioned earlier, the Review schema on your page comes from microdata tags in your page HTML and and is not being made by Site Reviews.
- This reply was modified 4 years, 6 months ago by Gemini Labs.
Here is a last tip if you are using the schema filter hooks to modify your schema. You can use the
glsr_debug
to print the generated schema on the page so you can see what you are working with:add_filter('site-reviews/schema/TVSeries', function ($schema) { if (!is_admin()) { // make sure we don't show this in the Gutenberg block editor! glsr_debug($schema); } return $schema; });
Just make sure to remove it when you are done making changes.
- This reply was modified 4 years, 6 months ago by Gemini Labs.
- This reply was modified 4 years, 6 months ago by Gemini Labs.
I believe there is one last thing needed, how do I add description?
add_filter(‘site-reviews/schema/Movie’, function ($schema) {
$postId = get_the_ID();
$schema[‘itemReviewed’] = get_post_meta( $postId, ‘schema_itemReviewed’, true );
$schema[‘description’] = get_post_meta( $postId, ‘schema_description’, true );
return $schema;
});Isn’t working as that’s under “Thing.” Should I change the base to Thing in order to get this?
The issue at hand is my excerpts are not showing up in Google now and it is either my author bio, or any text but the excerpt. I know certain things are beyond site reviews but it does show work for articles, I just don’t know how to get it to work for everything else.
It looks like the Site Reviews schema is not being generated at all. Please send me a screenshot of how you are using the code snippets.
If you are able to provide a login to the website that would help a lot (or if you have a login to a non-production version of the website that would be even better), otherwise a screenshot hopefully will help to figure out the problem.
You can send any details or screenshots using the Contact Support section of the plugin’s Help page.
Information sent.
- The topic ‘Trying To Get “Review” to show up in Product section of Schema’ is closed to new replies.