Add a new theme

  • TODO: write this doc

Edit a theme

  • Themes lay at /var/www//wp-content/themes

    • Most themes actually lay at /usr/share/wordpress/wp-content/themes
  • The themes for fr.squat.net have a git repo at https://0xacab.org/squatnet/fr.squat.net-themes You can clone this repo and cp files to the server after you have pushed your changes to the repo (otherwise they would be overwritten by next folks who also edit the theme). The customizations made from the WP admin interface are stored in the database, so don't worry about that.

List all themes used by our farm

This will go through all wordpress sites we host, and return their current theme. for i in $(ls /etc/wordpress/config-* | sed 's/^.*config-\(.*\)\.php$/\1/'); do echo $i; wp --allow-root --path=/usr/share/wordpress --url=$i option get current_theme; echo; done

Prevent a theme from requesting fonts to google

Modern way: install and enable https://wordpress.org/plugins/disable-remove-google-fonts/


Other way: Change the theme code to remove google calls. Changes will be lost of theme update, so using a child theme is a better idea.

  • In a theme, styles are added usually in functions.php. The google shit is also added there and is done in a function that is called wp_enqueue_style() or wp_register_style().
    • If one doesn't want to create a child theme, either comment wp_enqueue_style() out, or add wp_dequeue_style()
  • Create a child theme:
    • Create a theme folder called -child
    • Create style.css with this content: /* Theme Name: <parent theme name> Child Template: <parent theme folder name> (You can put here the other variables of the parent theme, it contains metadata wordpress uses on the Themes page) */
    • Create functions.php with this content: <?php function <parent_theme>_without_googlefonts_enqueue_styles() { // Load parent styles wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); // Here must be the same function that loads google shit in the parent theme, but without the nasty code that loads google shit } // Hook for wordpress to process our function add_action( 'wp_enqueue_scripts', '<parent_theme>_without_googlefonts_enqueue_styles' ); ?>