Archived topic
Add Comments and User Review Stars to a page built with Sections
5 replies · Started by Francesco on February 27, 2019
Hello there,
I would love to add Comments and Review Stars to a page built with sections. (looks like that works only without sections active)
Comments at the end of the page.
User Review Stars on top of the contents.
The page (via Rank Math seo plugin) is marked on schema markup as "article", I've already switched to "review" but nothing has changed.
How can I add these two things in the cleanest and effective way?
Thanks for your support.
[the page I'm referring is the home page]
Hi there,
Sections by default were never built to include comments or any sort of automatically placed content. The reason is that those items don't know which Section to add themselves to.
There is a potential solution here: https://generatepress.com/forums/topic/comments-using-sections/#post-325331
How did you switch the schema to reviews? Are you wanting to only change it on this one page?
Hi Tom,
thanks for your explanation, I have switched to a page without section, now comments load as expected!
1.
Regards schema data "review stars" I have tried 2 different plugins: one is "Rank Math" seo plugin the other is "Schema & Structured Data for WP" BUT both show me only editors rating.
Replying at your question: yes at this stage I would love to add only to this specific page (but if there is a viable solution is ok also to the entire site)
I'm looking for a solution where users can rate the article[page] and assign stars based on their preference. My goal is to display reviews stars inside Google serp snippet. (and if I'm not wrong the solution is by schema micro-data).
2.
I'm also looking to display, in the beginning of the page, the standard "date" and "author name" info. Is there a way to display also on pages instead of articles (where are displayed by default).
Thanks for your support.
Francesco
1. You could try this function:
add_filter( 'generate_article_itemtype', function( $type ) {
return 'Review';
} );
However, changing the itemtype like this might review you to make some other adjustments to the content/HTML.
2. Give this a shot:
add_filter( 'generate_entry_meta_post_types', function( $types ) {
$types[] = 'page';
return $types;
} );
Let me know :)
I have added both via snippet plugin ...but seems not working...
maybe I need to add in other way...is not clear in my mind...
thanks
Hmm, try this instead:
add_action( 'after_setup_theme', function() {
add_filter( 'generate_article_itemtype', function( $type ) {
return 'Review';
} );
add_filter( 'generate_entry_meta_post_types', function( $types ) {
$types[] = 'page';
return $types;
} );
} );