Title: Schema Help
Last modified: February 19, 2024

---

# Schema Help

 *  Resolved [mubashir062](https://wordpress.org/support/users/mubashir062/)
 * (@mubashir062)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/schema-help-2/)
 * Hello,
   firstly thank you so much for such a great theme and plugin.i am facing
   a problem that i need your help with.
 * I can see your theme/plugin reviews schema work with the reviews posted. however
   i am not showing or publishing any kind of reviews but i want to send data to
   schema from custom field. 
   I see the code wp-content/plugins/geodiro/includes/
   class-geodir-post-data.php from line 2179 to 2189.
 *     ```wp-block-code
       if ( $gd_post->overall_rating ) {
       	$schema['aggregateRating'] = array(
       	"@type"       => "AggregateRating",
       	"ratingValue" => $gd_post->overall_rating,
       	"bestRating"  => "5",
       // @todo this will need to be filtered for review manager if user changes the score.
       	"worstRating" => "1",
       	"ratingCount" => $gd_post->rating_count,
          );
       }
       ```
   
 * I have actually got my goal and successfully sending the data by small changes
   in code as follows
 *     ```wp-block-code
       if ( $gd_post->overall_rating ) {
       	$schema['aggregateRating'] = array(
       	"@type"       => "AggregateRating",
       	"ratingValue" => $gd_post->rrating,
       	"bestRating"  => "5",
       // @todo this will need to be filtered for review manager if user changes the score.
       	"worstRating" => "1",
       	"ratingCount" => $gd_post->rcount,
          );
       }
       ```
   
 * the problem i am facing is that whenever gerdirectory plugin update come. it 
   delete the modified code and replace with original.
 * is there any way to do it with function.php of the theme. because i already have
   child theme or something else.
 * i don’t want to lose plugin updates too because those are very important. and
   i can see you guys made very big improvements.
 * hope to hear from you soon.
 * kind regrds

Viewing 1 replies (of 1 total)

 *  Plugin Author [Paolo](https://wordpress.org/support/users/paoltaia/)
 * (@paoltaia)
 * [2 years, 3 months ago](https://wordpress.org/support/topic/schema-help-2/#post-17437231)
 * Hi,
 * Customization should be done by using hooks/filters via a snippet code plugin(
   or in functions.php of a child theme). Try following the PHP code snippet to 
   apply the customization you mentioned.
 *     ```wp-block-code
       function gd_snippet_custom_aggregateRating( $schema, $post ) {
       	global $gd_post;
   
       	if ( ! empty( $gd_post ) && ! empty( $gd_post->rrating ) ) {
       		$schema['aggregateRating'] = array(
       			'@type'       => 'AggregateRating',
       			'ratingValue' => $gd_post->rrating,
       			'ratingCount' => $gd_post->rcount,
       			'bestRating'  => '5',
       			'worstRating' => '1'
       		);
       	}
   
       	return $schema;
       }
       add_filter( 'geodir_details_schema', 'gd_snippet_custom_aggregateRating', 11, 2 );
       ```
   
 * Let us know how it goes.
 * Thanks,

Viewing 1 replies (of 1 total)

The topic ‘Schema Help’ is closed to new replies.

 * ![](https://ps.w.org/geodirectory/assets/icon-256x256.jpg?rev=2778361)
 * [GeoDirectory - WP Business Directory Plugin and Classified Listings Directory](https://wordpress.org/plugins/geodirectory/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/geodirectory/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/geodirectory/)
 * [Active Topics](https://wordpress.org/support/plugin/geodirectory/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/geodirectory/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/geodirectory/reviews/)

## Tags

 * [Updates](https://wordpress.org/support/topic-tag/updates/)

 * 1 reply
 * 2 participants
 * Last reply from: [Paolo](https://wordpress.org/support/users/paoltaia/)
 * Last activity: [2 years, 3 months ago](https://wordpress.org/support/topic/schema-help-2/#post-17437231)
 * Status: resolved