Skip to content

111 Recipes

How to target only HTML elements that have no CSS classes

Published ·UPD ·In Recipes

HTML elements without a class attribute or with an empty class attribute can be selected in CSS by using the negation pseudo-class and the attribute selector.

For example, to select paragraphs without classes:

p:not([class]),
p[class=""] {
  color: red;
}

The first selector in the group above selects all paragraphs without a class attribute. The second selects all paragraphs with an empty class attribute. Paragraphs with one or more classes are not affected and can be styled independently.

Documentation

WordPress Plugins

Published ·UPD ·In Resources

A list of WordPress plugins that I use often. The list is a work in progress.

Slugs for the ones available at the WordPress official repo:

admin-post-navigation classic-editor disable-comments disable-embeds disable-emojis omni-contact-form query-monitor relevanssi term-management-tools two-factor user-switching

How to delete (empty) the content of a file in Linux

Published ·UPD ·In Recipes
$ truncate -s 0 filename

What this command does: Truncates filename to a size of zero.

Documentation: manpages.debian.org/unstable/coreutils/truncate.1.en

How to auto-renew Let’s Encrypt certificates in Debian 10

Published ·UPD ·In Documentation

If Certbot is installed in Debian, renewal of certificates should be already automated and there is nothing else to do:

The Debian Certbot package installs a systemd timer which runs every 12 hours, calling a Certbot service. The Certbot service then executes the Certbot command for renewing expiring certificates.

To make sure the certbot timer is running, check the list of active timers:

$ systemctl list-timers

Or look at the status of the Certbot timer itself:

$ systemctl status certbot.timer

To see what exactly the Certbot service does:

$ less /usr/lib/systemd/system/certbot.service

More: Certbot – User Guide

How to remove all CSS classes and IDs from WordPress menu items

Published ·UPD ·In Recipes
add_filter('nav_menu_item_id', '__return_empty_string');
add_filter('nav_menu_css_class', '__return_empty_array');
add_filter('page_css_class', '__return_empty_array');

The three lines above will remove all IDs and classes from menu items, including classes for the current item. The current item can still be targeted using the aria-current attribute:

.menu li a[aria-current="page"] {
  color: red;
}

Documentation