Categories
WordPress

How to Find and Block AdSense Bad Bots

Shortly: a site publishing AdSense ads experienced a incredible increase of revenues (from 7 per day to 70 per day), but at the payment time, most of the earnings were classified as invalid traffic. One way to discover the IPs generating this traffic is to have Google Analytics connected with AdSense. In Analytics, go to […]

Categories
WordPress

How to transform a Vima By Me group data point to KNX

This piece of code han been kindly sent to me by a friend, I don’t know it’s original source. It’s few lines of python you can execute in an online python interpreter: text = format(0x1133,’016b’) output = [str(int(text[:5],2)), str(int(text[5:8],2)), str(int(text[8:],2))] print(output[0] + “/” + output[1] + “/” + output[2]) The bold number in the code […]

Categories
WordPress

knxd, OpenHab, Raspberry Pi, Vimar by Me

Playing with those tools is a good way to get crazy but is even funny, after all. This notes are not necessarily connected to the home automation by Vimar, but I’ve faced the problem with this kind of bus. I’m using an USB device to connect the Rapsberry Pi to the automation bus. The problem […]

Categories
WordPress

How the WP Scheduler Works

What is the WP scheduler also know as WP cron? It is a set of features which enable a plugin to schedule future tasks. Example of tasks are the publishing of a post, a backup, a cache folder maintenance and so on. There are mainly two kind of scheduling: the one shot, when a task […]

Categories
WordPress

Resize iframes (for video) maintainig the aspect ratio

Ok, so you have pages with iframes, maybe the old one from Youtube: but you want to force them to be 100% width: and the height won’t be correct. You can use FitVid.js or a piece of code like this one:

Categories
WordPress

Donations From January 2020 to September 2020

Here another round of donation of donations. Thank you all! The amount is 410 euros (about 480 $) to Medecins Sans Frontieres. Hope this small sign could help people around the World to gain in health and dignity.

Categories
WordPress

Execute Conditional JavaScript by Screen Size

You may need to execute JavaScript code conditioned by the css screen size, for example to have different behaviors on mobile devices (for example 480px). This article is a support for the Head and Footer plugin. So, if you need to do something in JavaScript when the screen size is less or equal than 480px, […]

Categories
WordPress

How To Store The Last Visit of Users

If you need to monitor when a user last accessed the site, maybe to gather stats of active and not active registered users, you can do it very easily in few lines of code. Of course you can attach your code to other hook, like the init hook. Attaching to template_redirect could avoid storing the […]

Categories
WordPress

How To Disable Shortcodes on Part of a Post

It may happen you need to disable shotcodes in a post or part of a post, because you’re writing documentation and you need to write shortcode examples and be sure they won’t be executed. Ok, I know, you can use the double square brackets but there were times went I went into trouble with shortcodes. […]

Categories
WordPress

Display the forum description on top of the main forum page

Forums can have a description and you can use it as a presentation offering, maybe, links to other resources, to rules and so on. To have that description displayed in the forum main page, you can code a custom theme part or use an hook. See the latter option. bbPress has the action bbp_template_before_single_forum fired […]