janvitos
Forum Replies Created
-
Forum: Plugins
In reply to: [Google Analytics Top Content Widget] Exclude current post from top postsFor anyone interested, I actually found out how to do it.
Here is the code I’m using in my single_post.php file:
<?php $top_content = do_shortcode('[google_top_content pageviews=5 number=6 showhome=no time=604800 timeval=1 thumb_size=medium]'); $top_content_url_found = strpos($top_content, $_SERVER['REQUEST_URI']); if ($top_content_url_found === false) { echo $top_content; } else { echo do_shortcode('[google_top_content pageviews=5 number=6 showhome=no time=604800 timeval=1 thumb_size=medium postfilter='. $post->ID .']'); } ?>
So essentially, what this does it trigger the shortcode and check if the current URL is there. If it’s not, then just return the shortcode. If the current URL is found, then remove the post ID, generate a new transient and return the shortcode. This way, only different transients will be created for the top posts.
- This reply was modified 8 years, 6 months ago by janvitos.
You could probably even shorten this line
'/(\!|\?|\.|\;|\%) (\?)/'
To
'/(\!|\?|\.) (\?)/'
OK, I’m done ??
Here is the rectified code without the bogus characters:
$pattern = array( '/(\?) (\w)/', '/(\w) (\!|\?|\:|\;|\?|\%)/', '/(\!|\?|\.|\;|\%) (\?)/' ); ksort($pattern); $replace = array( '$1 $2', '$1 $2', '$1 $2' ); ksort($replace);
As a temporary solution, I was able to fix the issue by modifying the following lines of code in nbsp-french.php:
$pattern = array( '/(\??) (\w)/', '/(\w) (\!|\?|\:|\;|\??|\%)/' ); ksort($pattern); $replace = array( '$1 $2', '$1 $2' ); ksort($replace);
And changing them to:
$pattern = array( '/(\??) (\w)/', '/(\w) (\!|\?|\:|\;|\??\%)/', '/(\!|\?|\.|\;|\%) (\??)/' ); ksort($pattern); $replace = array( '$1 $2', '$1 $2', '$1 $2' ); ksort($replace);
Sorry, my example didn’t come out right so I’ll show it again:
Initial sentence: ? Hello, this is a sentence. ?
After plugin filter: ?nbsp;Hello, this is a sentence. ? (no nbsp; between . and ?)It does this for any kind of punctuation, . ! ?, etc.
Forum: Plugins
In reply to: [Yoast SEO] Warning: DOMDocument::loadHTML()I confirm that the issue is resolved in 3.3.1.
Forum: Plugins
In reply to: [Yoast SEO] Warning: DOMDocument::loadHTML()Hi,
My NGINX error log seems to be filling up with the same errors since updating to 3.3.0.
Each time a post-sitemap.xml is accessed and not cached, the error log fills up with dozens of these lines:
PHP message: PHP Warning: DOMDocument::loadHTML(): htmlParseEntityRef: expecting ‘;’ in Entity, line: 1 in /wordpress/wp-content/plugins/wordpress-seo/inc/sitemaps/class-sitemap-image-parser.php on line 139
Thanks.
If anyone is interested, I found a temporary solution:
if (!-e $request_filename) {
rewrite ^/wordpress/wp-content/plugins/bwp-minify/cache/minify-b(\d+)-([a-zA-Z0-9-_.]+)\.(css|js)$ /index.php?blog=$1&min_group=$2&min_type=$3 last;
}By adding the if (!-e $request_filename) to the rewrite rule, it only rewrites IF the requested file is not found. This has improved dramatically server response time, as noted in newrelic.
Though, a solution using try_files would be even better.