Skip to content

Commit 6005d0e

Browse files
authored
Merge pull request #69 from n49/slider_v1.0.97
excluded json schema from nitropack
2 parents 87a367f + 4fa70b3 commit 6005d0e

3 files changed

Lines changed: 16 additions & 4 deletions

File tree

includes/class-feed-shortcode.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ private function extract_jsonld_schema(&$html) {
3434
/**
3535
* Extract all link and script tags from head section (everything except JSON-LD schema)
3636
* Prioritizes font links to ensure they load first
37+
* Adds Nitropack exclusion attributes to prevent optimization issues
3738
*/
3839
private function extract_head_resources($html) {
3940
$font_links = '';
@@ -49,8 +50,17 @@ private function extract_head_resources($html) {
4950
foreach ($link_matches[0] as $link) {
5051
// Prioritize font links (Google Fonts, etc.)
5152
if (preg_match('/fonts\.(googleapis|gstatic)/i', $link) || preg_match('/font/i', $link)) {
53+
// Add Nitropack exclusion attributes to font links to prevent optimization issues
54+
if (strpos($link, 'data-nitro-exclude') === false) {
55+
// Insert data-nitro attributes before closing >
56+
$link = str_replace('>', ' data-nitro-exclude="all" data-nitro-ignore="true">', $link);
57+
}
5258
$font_links .= $link . "\n";
5359
} else {
60+
// Add Nitropack exclusion to other stylesheets as well
61+
if (strpos($link, 'rel="stylesheet"') !== false && strpos($link, 'data-nitro-exclude') === false) {
62+
$link = str_replace('>', ' data-nitro-exclude="all" data-nitro-ignore="true">', $link);
63+
}
5464
$other_links .= $link . "\n";
5565
}
5666
}
@@ -129,7 +139,9 @@ public function init($atts) {
129139
echo $jsonld_schema;
130140
}
131141

132-
// 2. Head resources (links and scripts)
142+
// 2. Head resources (links and scripts) - must come before div with "all: initial"
143+
// Font links need to load before the CSS reset applies
144+
// Note: Links and scripts in body are valid HTML5, but should be output early
133145
if (!empty($head_resources)) {
134146
echo $head_resources;
135147
}

opio.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Plugin Name: Widget for OPIO Reviews
44
Plugin URI:
55
Description: Instantly add OPIO Reviews on your website to increase user confidence and SEO.
6-
Version: 1.0.96
6+
Version: 1.0.97
77
Author: Dhiraj Timalsina <dhiraj@n49.com>
88
Text Domain: widget-for-opio-reviews
99
Domain Path: /languages
@@ -22,7 +22,7 @@
2222

2323
require(ABSPATH . 'wp-includes/version.php');
2424

25-
define('OPIO_PLUGIN_VERSION' , '1.0.96');
25+
define('OPIO_PLUGIN_VERSION' , '1.0.97');
2626
define('OPIO_PLUGIN_FILE' , __FILE__);
2727
define('OPIO_PLUGIN_URL' , plugins_url(basename(plugin_dir_path(__FILE__ )), basename(__FILE__)));
2828
define('OPIO_ASSETS_URL' , OPIO_PLUGIN_URL . '/assets/');

readme.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Author: Dhiraj Timalsina
33
Tags: Widget for OPIO Reviews, opio, reviews, rating, widget, google business, testimonials
44
Tested up to: 6.4
5-
Stable tag: 1.0.96
5+
Stable tag: 1.0.97
66
License: GPLv2 or later
77
License URI: http://www.gnu.org/licenses/gpl-2.0.html
88

0 commit comments

Comments
 (0)