• Resolved lovemp3

    (@lovemp3)


    Hi,

    1. I try to add schema type properties, but I failed. All the existing schema type disapeared except those I add. Could anyone please give me an example on this?

    // Modify the JSON-LD schema type properties
    $schemaType = 'LocalBusiness';
    add_filter( "site-reviews/schema/{$schemaType}" , function( array $schema , array $args ) {
    	$schema = array(
    		'address' => 'address',
    		'priceRange' => 'priceRange',
    		'telephone' => 'telephone'
    	);
    	return $schema;
    }, 10, 2 );

    2. I found this plugin doesn’t support Chinese Characters as Chinese Characters become numbers. Is there any way to fix this?

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

    (@geminilabs)

    1. You need to modify $schema instead of replacing it. Example:

    add_filter( "site-reviews/schema/LocalBusiness", function( array $schema ) {
        $schema['telephone'] = '0123456789';
        return $schema;
    });

    2. Please send me a link so I can see the issue.

    Thread Starter lovemp3

    (@lovemp3)

    Hi, Gemini Labs,

    I’ve sent you a link with JSON-LD code generated by Site Reviews to your email, site-reviews[at]geminilabs.io.

    <script type="application/ld+json">
        [{
            "@context": "http:\/\/schema.org",
            "@type": "LocalBusiness",
            "name": "\u4e2d\u58e2\u79ae\u5100\u516c\u53f8\u3001\u4e2d\u58e2\u846c\u5100\u793e\u3001\u4e2d\u58e2\u79ae\u5100\u516c\u53f8\u63a8\u85a6\u3001\u4e2d\u58e2\u846c\u5100\u793e\u63a8\u85a6\u3001\u6843\u5712\u64bf\u9aa8\uff1a\u975c\u5fc3\u751f\u547d\u79ae\u5100\u516c\u53f8\uff0c\u5168\u53f0\u5c08\u4eba\u670d\u52d9\uff0824H\uff09\u3002",
            "description": "",
            "image": "https:\/\/peaceful.tw\/wp-content\/themes\/iweb\/images\/logo.png",
            "url": "",
            "aggregateRating": {
                "@type": "AggregateRating",
                "ratingValue": 5,
                "reviewCount": 33
            },
            "address": "\u6843\u5712\u5e02\u4e2d\u58e2\u5340\u4e2d\u798f\u8def 850 \u865f",
            "priceRange": "128,000 - 268,000",
            "telephone": "+886926822319"
        }]
    </script>

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    Thank you.

    • This reply was modified 7 years, 2 months ago by bdbrown.
    Plugin Author Gemini Labs

    (@geminilabs)

    There is nothing wrong with the JSON-LD, those numbers you are seeing are actually UTF-8 hexadecimal representations of the Chinese characters. If you go to https://search.google.com/structured-data/testing-tool and enter your URL you will see that the schema is being read correctly as expected.

    However, it’s not really necessary to encode UTF-8 characters in the JSON-LD so in the next version I’ll adjust Site Reviews to not do that.

    Thread Starter lovemp3

    (@lovemp3)

    Thank you a lot.

    Plugin Author Gemini Labs

    (@geminilabs)

    Version 2.9.2 should correct the issue, although it was purely a cosmetic one. ??

    Thread Starter lovemp3

    (@lovemp3)

    Hi, Gemini Labs,

    My current solution for this cosmetic one is to add ‘JSON_UNESCAPED_UNICODE’ in ‘site-reviews\plugin\Schema.php’ at line 138. I am not sure if this is the right way, but it looks ‘beautiful’ now.

    	 * @return null|string
    	 */
    	public function render()
    	{
    		if( is_null( $this->app->schemas ))return;
    		return sprintf( '<script type="application/ld+json">%s</script>', json_encode(
    			apply_filters( 'site-reviews/schema/all', $this->app->schemas ), JSON_UNESCAPED_UNICODE
    		));
    	}

    I am much looking forward to Version 2.9.2.

    ===========================================

    BTW, I found another issue that some setting gone (become unchecked) in plugin setting area after I press save in other tab within settion area.

    To be specific, I first check ‘Name’ filed in tab ‘Required Fields’, then I change ‘Rich Snippets (schema.org)’ in tab ‘Reviews’. When I return to the ‘Required Fields’, the check of ‘Name’ disapeared.

    Plugin Author Gemini Labs

    (@geminilabs)

    v2.9.2 was released yesterday.

    Regarding the settings, each section has its own “Save Settings” button. You must save the settings before going to another settings section.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Modify the JSON-LD schema type properties’ is closed to new replies.