PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 2.22.1
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v2.22.1
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
← All changes | app/src/Controllers/Web/BasePageController.php +19 -1 4.4.12.22.1 View file →
@@ -85,8 +85,10 @@
85 85 // add scripts.
86 86 add_action( 'wp_enqueue_scripts', [ $this, 'scripts' ] );
87 87 // preload image.
88 88 add_action( 'wp_head', [ $this, 'preloadImage' ] );
89 + // maybe add json schema.
90 + add_action( 'wp_head', [ $this, 'displaySchema' ] );
89 91 // add meta title and description.
90 92 add_action( 'wp_head', [ $this, 'addSeoMetaData' ] );
91 93 }
92 94
@@ -117,8 +119,24 @@
117 119 <?php
118 120 }
119 121
120 122 /**
123 + * Display the JSON Schema.
124 + *
125 + * @return void
126 + */
127 + public function displaySchema(): void {
128 + $schema = $this->model->getJsonSchemaArray() ?? [];
129 +
130 + if ( empty( $schema ) ) {
131 + return;
132 + }
133 + ?>
134 + <script type="application/ld+json"><?php echo wp_json_encode( $schema ); ?></script>
135 + <?php
136 + }
137 +
138 + /**
121 139 * Preload the product image.
122 140 *
123 141 * @return void
124 142 */
@@ -147,9 +165,9 @@
147 165 * @param string $title The title.
148 166 *
149 167 * @return string
150 168 */
151 - public function disallowPreTitle( $title ) {
169 + public function disallowPreTitle( $title ): string {
152 170 if ( ! empty( $this->model->id ) ) {
153 171 return '';
154 172 }
155 173 return $title;