Tag: Wordpress

Don’t include external JS for custom content example Goodreads

On many websites, you can have content embedded from other sites and one way that most external sites will offer will be to include a script that’s hosted on their website.

But if all that script does is including some remote content there are better ways to get that, that will provide customizations and performance.

For example, the website Goodreads offers such an embed JS with a list of the latest books you read, and you must include the script where you want the content to be shown. But that has a long list of drawbacks: the script uses the old API document.write, is a script and can’t be loaded in AMP, the scripts write very old style HTML with tags like center, attributes like border which again is not valid AMP, then also that script will be loaded for every request, so you’ll have one additional request. View full article

Build a Simple WordPress commenting system on top of the native one with AMP support

There are a lot of commenting system plugins out there but most of them come with a cost, and sometimes just building a simple WordPress commenting system on top of the native commenting system can be enough.

The main features of this system will be:

  • Comments will be only loaded if the user clicks a button
  • Comments will be submitted and fetched by JS
  • Comments will have paginations fetched by JS
  • Comments will have some JS interactivity
  • Comments will have the reply feature enabled
  • The comment system will have an AMP implementation
  • The comment system will have a no JS implementation
  • Comments will work the same on AMP with our own script

The first thing will have to do for our system is to make some custom REST API for the JS to fetch. View full article

WordPress 4.7.0 4.7.2 _e() function, languages and broken translations

Some time ago I read about a critical vulnerability present in WordPress 4.7.0 and 4.7.1(it was seriously severe, it primarily let attackers change data in your DB using restful API), and I had a website that I did back in 2015, the problem is that I did the theme using _e function(mostly on the front page) for translations as it was a multilingual website.

Anyway, I updated from 4.7.2 to 4.7.3 and <<BAM>> all translations were broken. It was a bit curious though why this update broke the translation if in 4.7.0 they worked fine, so started to see if any change was written in the official documentation that I could find on these links: I18n_for_WordPress_Developers and developer.wordpress.org/themes/functionality/internationalization View full article

wp-downloadmanager bug fix 1.68.1

So if you want a WordPress plugin for managing downloads and to be capable of working with external URLs you can choose this plugin(wp-downloadmanager). Unfortunately on the WordPress plugin directory, there aren’t so many plugins that have in their design external URLs, of course, external URLs aren’t what you would want most of the time but there are some cases where such URLs are preferred and this was my case too.

After installing this plugin I detected that it had a bug exactly when working with external URLs. I had notified the author and he said that he might fix this bug.
The bug consists of unusable external download links saved in the database, this happens when the remote download URL is a bit ugly, and it contains characters like &,? View full article