- This topic has 19 replies, 2 voices, and was last updated 4 years, 5 months ago by
Tom.
-
AuthorPosts
-
December 18, 2018 at 12:03 pm #760514
Nacho
Hello,
I´m having issues with the star rating widget since in the schema markup test it shows errors and google is not recognizing the rating as you can see in this test: https://search.google.com/structured-data/testing-tool?hl=es#
The site I´ve tested is my own homepage but nothing. It seems to be working with the basic themes as twenty fifteen and with the elementor canvas for example but with GP it does not.
Can you help me with this?
Thanks a lot.
Bests,
-Nacho.
December 18, 2018 at 5:32 pm #760714Tom
Lead DeveloperLead DeveloperHi there,
This is because Elementor is setting the ratings microdata for the stars, but it’s not setting a type to the actual container.
By default, GP uses
CreativeWork
as the content type. We can change it toProduct
with a filter, but it might be better to apply that type to the individual containers that actually hold the ratings, as the entire page doesn’t seem to be a product.Let me know 🙂
December 18, 2018 at 11:38 pm #760859Nacho
Hello Tom,
Understood, well kind of.
How do I change the content type of GP to a services page with ratings and how do I change the individual container?
Thanks a lot for your help.
December 19, 2018 at 10:09 am #761404Tom
Lead DeveloperLead DeveloperFor the GP container, you can do this:
add_filter( 'generate_article_itemtype', function( $type ) { return 'Product'; } );
However, that assumes the page is geared towards a product.
I’m not sure about the specific Elementor container – that may be something they need to answer.
December 19, 2018 at 11:55 pm #761787Nacho
Hello Tom,
But that filter will work in every page right? What if I just want to do that just for a particular page?
Also, it sets the page as a product or just the container?
I´ve sent a message to the Elementor team and I´m waiting for them to answer. I´ll let you know.
Last one, How can I set the padding for the content in the container just for a particular page?
Thanks a lot for your help Tom.
December 20, 2018 at 8:45 am #762244Tom
Lead DeveloperLead DeveloperThat code does every page on the site.
You can target a specific page like this:
add_filter( 'generate_article_itemtype', function( $type ) { if ( is_page( 10 ) ) { return 'Product'; } return $type; } );
You just need to adjust the
10
to the page ID you’re targeting.This changes the schema type of the content container provided by the theme.
For the padding, try this:
.page-id-10.separate-containers .inside-article, .page-id-10.one-container .site-content { padding: 50px; }
Again, make sure to update the
10
to the actual page ID.December 20, 2018 at 8:56 am #762256Nacho
Hello Tom,
The filtering thing does not work well. I´ve updated the URL in this topic and tested in Google Schema and it shows more errors than before.
I´ve tried the padding and worked perfect.
Is this schema thing fixable?
Thanks a lot.
December 20, 2018 at 10:06 pm #762612Tom
Lead DeveloperLead DeveloperThe filter worked, but it seems the type of review rating you’re using isn’t compatible with the
Product
type. The other errors are recommended items that should be present when usingProduct
.You could try using
Review
instead ofProduct
as your type.December 21, 2018 at 8:23 am #763093Nacho
Hello Tom,
I´ve just tried but nope same errors.
I´ve been searching in the forum but I don´t see anything.
Any idea?
Thanks a lot.
December 21, 2018 at 8:31 am #763108Tom
Lead DeveloperLead DeveloperAnother option is to disable the GP schema on that page:
add_filter( 'generate_schema_type', function( $type ) { if ( is_page( 10 ) ) { return false; } return $type; } );
December 21, 2018 at 8:46 am #763124Nacho
Hello Tom,
I´ve just tried and it does not work either.
Is there another info I can give to solve this?
Thanks a lot.
December 21, 2018 at 8:54 am #763133Tom
Lead DeveloperLead DeveloperThe only thing we can do is remove the schema to prevent errors. Elementor itself would need to give the box containing the reviews the proper schema type.
Another method to disable the GP schema on that page is this:
add_filter( 'generate_article_microdata',function( $data ) { if ( is_page( 10 ) ) { return false; } return $data; } );
Again,
10
needs to be changed to the ID of that specific page.It likely won’t fix all of the errors, as the review schema needs a proper schema type attached to its container.
December 21, 2018 at 8:58 am #763136Nacho
Hello Tom,
Oh yes I´m changing the ID all the time to mine.
I´ve just tried that but nothing, loads of errors and the important one that Schema rating is not recognized.
Do you recommend inserting an schema plugin there instead the elementor one?
Thanks Tom.
December 21, 2018 at 5:44 pm #763368Tom
Lead DeveloperLead DeveloperIs that last function still active? It seems the container is still set to
Product
.A JSON-LD plugin might help 🙂
December 24, 2018 at 1:31 am #764556Nacho
Hello Tom,
Yes, the last function is still active.
Why? Did you find something to work on this?
About the JSON-LD, I thought I saw in your blog that you were releasing this later?
Thanks a lot Tom.
-
AuthorPosts
- You must be logged in to reply to this topic.