From 93df5af635109114f140b17b0fafdd250b4c3754 Mon Sep 17 00:00:00 2001 From: Dan D Date: Mon, 26 Feb 2018 20:10:53 -0600 Subject: [PATCH] Push 1.5.0 structured data and timestamp filtering --- README.md | 8 +++ codeable-reviews-and-expert-profile.php | 92 +++++++++++++++++++++++-- 2 files changed, 95 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 99706cd..6ddbf30 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,10 @@ Stores expert and review information from the API in transients to lower number * filter_reviews, comma seperated list of review IDs to exclude from display * only_clients, comma serpated list of client IDs to exclusively display (other filters still apply) * only_reviews, comma serpated list of review IDs to exclusively display (other filters still apply) +* schema=yes Enable structured data using json-ld (aggregate review, review markup) (yes to enable, only use this once per page for now) +* schema_desc="Your description here" (default is: Custom WordPress work through Codeable.io) +* start_time (unix timestamp, will only show reviews published after this time) +* end_time (unix timestamp, will only show reviews published before this time) ### Optional atts: expert_image * circle=yes , default is yes shows image as a circle @@ -61,6 +65,10 @@ Stores expert and review information from the API in transients to lower number == Changelog == += 1.5.0 = +* First version of schema / structured data (aggregate review, reviews): schema, schema_desc atts +* Added ability to filter displayed reviews by start_time and end_time (must be in Unix timestamp format) + = 1.4.1 = * Added sanitizing of external data (esc_html / esc_url where appropriate) diff --git a/codeable-reviews-and-expert-profile.php b/codeable-reviews-and-expert-profile.php index ef8684d..fa956bb 100644 --- a/codeable-reviews-and-expert-profile.php +++ b/codeable-reviews-and-expert-profile.php @@ -4,7 +4,7 @@ Plugin URI: https://dandulaney.com GitHub Plugin URI: https://github.com/duplaja/codeable-reviews-and-expert-profile Description: Gathers Codeable Reviews and Profile Information for a Codeable Expert -Version: 1.4.1 +Version: 1.5.0 Author: Dan Dulaney Author URI: https://dandulaney.com License: GPLv2 @@ -282,8 +282,12 @@ function codeable_display_reviews($atts){ 'show_rating'=> 'yes', //Show rating on each review 'filter_clients' => '', //Comma seperated list of client IDs to filter out 'filter_reviews' => '', //Comma seperated list of review IDs to filter out - 'only_clients' => '', //Comma seperated list of client IDs to include (filters all others) - 'only_reviews' => '', //Comma seperated list of review IDs to include (filters all others) + 'only_clients' => '', //Comma seperated list of client IDs to include (filters all others) + 'only_reviews' => '', //Comma seperated list of review IDs to include (filters all others) + 'schema' => '', //Send yes to include review schema (once per page only) + 'schema_desc' => 'Custom WordPress work through Codeable.io', //Product description for schema + 'start_time' => '', //Unix timestamp, shows reviews after this time + 'end_time' => '', //Unix timestamp, shows reviews before this time ), $atts, 'expert_completed' ); if (empty($atts['codeable_id'])) { @@ -305,6 +309,28 @@ function codeable_display_reviews($atts){ //Retrieves (from api or transient) all stored reviews $codeable_review_data = codeable_handle_review_transient($atts['codeable_id'],$to_pull); + $schema = $atts['schema']; + if ($schema=='yes') { + + $codeable_expert_data = codeable_handle_expert_transient($atts['codeable_id']); + + $schema_data = ' + '; + + $to_return.=$schema_data; + } + return $to_return; }