• Resolved ducod

    (@ducod)


    Hi,

    Thanks for your greate plugin, I recently need a product review feature like this:

    A. Show the review numbers(stars, numbers of reviews) in the pointed area of the homepage.

    Then the shortcode I am using:(I think here I should use the assginto feature to point to the review page’s id)

    [site_reviews_summary text="Reviews {num}" schema="true"? hide="summary,bars"]

    However, the result I got: rating+star

    B. I want to create an entrace that after clicking on the homepage’s review number, it redirects the users to a review page and the user can check the list of the reviews and also can submit their owns.

    Something like this:

    1. Homepage: Stars <a href="https://www.domain.com/reviews" target="_blank" rel="noopener noreferrer">Reviews(101)</a>

    2. Click on Reviews(101) and then the page turns to review page

    3. Review page:

    Recent list of reviews showing 10 result per page.
    Users submit form

    Can I use Site Reviews to do like this? Please help, thanks very much!

    • This topic was modified 5 years, 11 months ago by ducod.
    • This topic was modified 5 years, 11 months ago by ducod.
    • This topic was modified 5 years, 11 months ago by ducod.
    • This topic was modified 5 years, 11 months ago by ducod.
Viewing 15 replies - 1 through 15 (of 16 total)
  • Plugin Author Gemini Labs

    (@geminilabs)

    A.

    1. To show your custom text and hide the average rating, you need to use the shortcode like this:

    [site_reviews_summary text="Reviews {num}" schema=true hide=rating,bars]
    
    

    2. To change the layout of the shortcode fields, you will need to either use some custom CSS, or use a custom template. To use a custom template, please see the Site Reviews > Documentation > FAQ page (How do I change the order of the reviews summary fields?).

    B.

    1. Homepage

    You can add a link directly into the shortcode text option:

    [site_reviews_summary text="<a href='/reviews'>Reviews ({num})</a>" hide=rating,bars]
    
    

    See also: https://pastebin.com/jE7PBcRJ

    2. Reviews page

    [site_reviews pagination=ajax count=10]
    [site_reviews_form]
    

    Please make sure to read the Site Reviews > Documentation > Shortcodes page.

    • This reply was modified 5 years, 11 months ago by Gemini Labs.
    Thread Starter ducod

    (@ducod)

    Thanks so much for your quick response!

    Should I assign to the reviews page in the homepage’s shortcode? the reviews page id is 2600. Or will the {num} from the homepage auto add numbers once getting new reviews.

    Plugin Author Gemini Labs

    (@geminilabs)

    By default, reviews are global meaning they are not assigned to any page.

    If you have multiple pages that need their own reviews, you can use the “assign_to” and “assigned_to” options.

    Otherwise, leave them unassigned.

    Without the “assigned_to” option, the summary shortcode will show the average rating for all reviews.

    • This reply was modified 5 years, 11 months ago by Gemini Labs.
    Thread Starter ducod

    (@ducod)

    OK, I will try it. Thanks again for your help!

    Thread Starter ducod

    (@ducod)

    I’ve added the code to function.php and then the shortcode to the page.

    //Reviews add Link
    add_filter( 'site-reviews/rendered/template/reviews-summary', function( $template, $data ) {
        if( !empty( $data['context']['assigned_to'] )) {
            $permalink = get_the_permalink( $data['context']['assigned_to'] );
            $title = get_the_title( $data['context']['assigned_to'] );
            if( $permalink && $title ) {
                $assignedToPermalink = sprintf( ' of <a href="%s">%s</a>', $permalink, $title );
                $template = preg_replace( '/(\(based on \d+ reviews?)(\))/', '$1'.$assignedToPermalink.'$2', $template );
            }
        }
        return $template;
    }, 10, 2 );

    However, the link isn’t working,

    showing like this:

    Stars
    <a href='/reviews'>Reviews (2)</a>

    What should I do now? Thanks.

    • This reply was modified 5 years, 11 months ago by ducod.
    Plugin Author Gemini Labs

    (@geminilabs)

    The code from the pastebin link is for showing the permalink for the assigned page, and only works if you are not using custom summary text. Since you are both using custom summary text, and not assigning reviews, the code will have no affect.

    I suggest you add the link into the shortcode directly like this:

    [site_reviews_summary text="<a href='/reviews'>Reviews ({num})</a>" hide=rating,bars]
    
    

    Make sure you use single quotes inside double quotes when doing this.

    For example, do this:

    text="<a href='/reviews'>Reviews ({num})</a>"

    Not this:

    text="<a href="/reviews">Reviews ({num})</a>"

    Thread Starter ducod

    (@ducod)

    [site_reviews_summary text="<a href='/reviews'>Reviews({num})</a>" schema="true" class="text-align:center" hide="rating,bars"]

    Yes, I used the single quotes to the URL, however, I got the result finally like this:

    Screenshot

    What’s wrong?

    Thread Starter ducod

    (@ducod)

    Hi, I finally used the solution as below:

    1. Assign_to the review page and then added the code from Pastebin link.
    2. Add drop_menu in the same review page where has two categories.

    Added the shortcode to the product page 1:
    [site_reviews_summary category=1417 assigned_to="2600" schema=true hide=rating,bars]

    Added the shortcode to the product page 2:
    [site_reviews_summary category=1418 assigned_to="2600" schema=true hide=rating,bars]

    Both of these two pages can have the stars and review numbers showing as like the screenshot.

    However, the text="<a href='/reviews'>Reviews ({num})</a>"code isn’t working on my theme, don’t know why.

    BTW,
    1. How can I add the search bar in the Review page if someone wants to search for the target keywords to filter the current results? Check this screenshot
    2. How to add the category name beside each review —Check this screenshot

    Plugin Author Gemini Labs

    (@geminilabs)

    1. In order for [site_reviews_summary text="<a href='/reviews'>Reviews({num})</a>" schema=true hide=rating,bars] to work, you will need to paste it into the plain-text editor. If you paste it into the rich-text editor, it will not work.

    If you are using a plugin to cache pages, make sure to clear the cache.

    2. Do not use the category option together with the assigned_to option. In Site Review v3.5 this will break the summary review counts. This will also make the database queries slower (as they cannot be cached if you use both options) even after this has been fixed in v3.6. If you are assigning reviews to multiple pages, there should be no reason to also assign them to a category. Likewise, if you are assigning reviews to multiple categories, there is no reason to also assign them to a page. Use whichever is most suitable, but not both.

    3. To search reviews, please see: https://pastebin.com/XWpekXXA

    4. If you plan isolate reviews to specific pages, I suggest you use the assign_to and assigned_to options (instead of the category option), and also use the “Enable Assigned Links” option in the plugin settings.

    • This reply was modified 5 years, 11 months ago by Gemini Labs.
    • This reply was modified 5 years, 11 months ago by Gemini Labs.
    • This reply was modified 5 years, 11 months ago by Gemini Labs.
    Thread Starter ducod

    (@ducod)

    Yes, I did paste the code in the plain text area, check the screenshot,

    But the result I got is only:No URL, check this screenshot

    For the category and assigned_to feature, that means I need to create a review page separately for product 1 and product 2.

    Plugin Author Gemini Labs

    (@geminilabs)

    1. If you already have “product 1” and “product 2”, then you don’t need to create new pages as those are the page IDs that you would assign the reviews to.

    For example, paste this on each product page:

    [site_reviews assigned_to=post_id pagination=ajax count=10]

    This will show all reviews that have been assigned to each product.

    Then if you allow review submissions on the same product pages, you would paste this:

    [site_reviews_form assign_to=post_id]

    If your website structure does not allow you to assign reviews to a product page directly (perhaps products do not have a single-page view), then use the category option instead.

    2. If the code is not working, then something else may be preventing it as it works perfectly for me. If you like, you can go to the Site Reviews > Documentation > Support page and follow the instructions to contact support. Please make sure to attach the console log and system info as it instructs you to.

    Thread Starter ducod

    (@ducod)

    BTW, sorry for my lack of code skills,

    I tried to use the schema feature with the Custom section(check this screenshot) and after testing in Google Construction tool, the result shows that I need to add the required operatingsystem and applicationcategory value, though I checked the schema.org document in the document page. and then add the code as follow:

    add_filter( 'site-reviews/schema/Custom', function( array $schema ) {
    	$schema['SoftwareApplication'] = [
    		'@type' => 'Entrypoint',
    		'applicationCategory' => 'Backup,Restore',
    		'operatingSystem' => 'Windows,Mac',	
    	];
    	return $schema;
    });

    But it seems it doesn’t work. What should I do then?

    Plugin Author Gemini Labs

    (@geminilabs)

    Using this as a reference, and assuming that you have used “SoftwareApplication” as the custom schema type in the plugin settings, it would look something like this:

    add_filter( 'site-reviews/schema/SoftwareApplication', function( $schema ) {
        $schema['author'] = [
            '@type' => 'Organization',
            'url' => '', // author url
            'name' => '', // developer name
        ];
        $schema['fileSize'] = ''; // file size e.g. 14MB
        $schema['interactionCount'] = ''; // number of user downloads
        $schema['contentRating'] = '';
        $schema['downloadURL'] = ''; // download url
        $schema['operatingSystem'] = [
            'Mac',
            'Windows',
        ];
        $schema['applicationCategory'] = ''; // application category e.g. https://schema.org/GameApplication
        $schema['Offers'] = [
            '@type' => 'Offer',
            'price' => '', // app price
        ];
        return $schema;
    });

    I hope this helps. Please refer to the link above, Google search, https://schema.org, and Google’s Structured Data Testing Tool to determine any other required or recommended schema fields that the Structured Data Testing Tool shows are needed.

    • This reply was modified 5 years, 11 months ago by Gemini Labs.
    Thread Starter ducod

    (@ducod)

    The Schema code is working! Thanks so much for your help! As for the custom text with link issue I’ve contacted with the email support, so, it’s time to close this thread, thanks very much for your help!

    Plugin Author Gemini Labs

    (@geminilabs)

    @ducod

    1. The custom text link is not working because for some reason, possibly due to the page builder plugin that is installed with your theme, the link does not work if the href attribute of the link uses single quotes. To fix this, you will need to swap single quotes for double quotes.

    For example:

    This does not work

    [site_reviews_summary text="<a href='/reviews'>Reviews ({num})</a>" hide="rating,bars"]
    
    

    But this does work

    [site_reviews_summary text='<a href="/reviews">Reviews ({num})</a>' hide="rating,bars"]
    
    

    2. I noticed that you are putting CSS code in the “class” option. This is incorrect and will not work.

    This is incorrect and will not work

    [site_reviews_form class="background-color:#f3f3f3"]
    
    

    This is correct

    [site_reviews_form class="custom-background-color"]
    
    

    And you would add this custom CSS to your theme:

    .custom-background-color {
        background-color: #f3f3f3;
    }
    
    
Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Can Site Reviews do like this?’ is closed to new replies.