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 […]

Categories
WordPress

Precheck the notification option on bbPress new topic form

Usually, if you contribute a forum sending a request, you want to know if someone replies. On bbPress you can just activate the notifications on the topic you’re creating. But it comes unchecked by default. And in a world of distracted people, assuming the most of your participant want to know if they set a […]

Categories
WordPress

Hide the subscription toggle on bbPress forums

You may need to disable the subscription to mail notifications connected to a forum. If a forum is really busy and someone, wrongly, subscribe it, she’ll start to receive tons of emails. There is not need to work at the code level to disable the subscription functionality, you can simply hide, with a CSS rule, […]

Categories
WordPress

How To Change the WP Email From Name in 3 Lines

All emails sent by a clean installation of WordPress go out with the sender name “WordPress” and the address “wordpress@yourdomain.com”. Since it’s not so nice to receive emails from a site and see in the sender name “WordPress” it is usually a good choice to change it. I don’t know why WordPress doesn’t make this […]

Categories
WordPress

Donations From January 2019 to November 2019

Dear friends, in the last 11 months 360 euro have been collected with donations and today I’ve sent that money to humanitarian initiative through Medecins Sans Frontieres and Save the Children. Hope the best for you and your families. Hope more and more children can enjoy their life with our little help and have future […]

Categories
WordPress

is_admin() WordPress Function: Misusage

Pay attention and do not use it improperly. The is_admin() function is NOT to check is the current user is an administrator! I saw this error many times and probably I did it myself years ago. The is_admin() function provided by WordPress as core function is not to check if the current user is an […]

Categories
WordPress

Dynamically Disable a Plugin

Is it possible to dynamically “disable” a plugin with a condition determined by some visitor attributes? Like the presence of a cookie? Of course without changing the plugin code! Recently I faced this problem: a rather weight plugin that integrates a chat (and more) in a WP site was make the site itself too slow. […]