Skip to content

Instantly share code, notes, and snippets.

View franz-josef-kaiser's full-sized avatar

Franz Josef Kaiser franz-josef-kaiser

View GitHub Profile
@franz-josef-kaiser
franz-josef-kaiser / nano-shorts.md
Last active April 8, 2024 09:27
nano keyboard shortcuts

^ = Ctrl key M = Alt key

^G      (F1)            Display this help text
^X      (F2)            Close the current file buffer / Exit from nano
^O      (F3)            Write the current file to disk
^J      (F4)            Justify the current paragraph

^R      (F5)            Insert another file into the current one
@franz-josef-kaiser
franz-josef-kaiser / wp-config.php
Last active December 2, 2023 01:03
My default wp-config.php file for the nightly.dev stack. Not beautiful, but it got everything.
<?php
# SHORTS
# DIRECTORY SEPARATOR
define( 'DS', DIRECTORY_SEPARATOR );
# PATH SEPARATOR
define( 'PS', PATH_SEPARATOR );
# Absolute path to the WordPress directory.
! defined( 'ABSPATH' )
AND define( 'ABSPATH', dirname( __FILE__ ).DS );
@franz-josef-kaiser
franz-josef-kaiser / docker.sh
Created May 9, 2020 22:57
Run Volumio hifi audiophile in a docker container on MacOS
#!/usr/bin/env bash
mkdir music data
set MUSIC_DIR=./music
set VOLUMIO_DATA_DIR=./data
docker run \
--rm \
-d \
--name volumio \
-e DISPLAY=unix$DISPLAY \
-e HOST=http://192.168.1.1:3000 \ # Your local network IP
@franz-josef-kaiser
franz-josef-kaiser / wpmail_exceptions.php
Last active November 27, 2023 08:38
WP Mail Error/Exception handling and SMTP settings
<?php
defined( 'ABSPATH' ) OR exit;
/**
* Plugin Name: (WCM) PHPMailer Exceptions & SMTP
* Description: WordPress by default returns <code>FALSE</code> instead of an <code>Exception</code>. This plugin fixes that.
*/
add_action( 'phpmailer_init', 'WCMphpmailerException' );
function WCMphpmailerException( $phpmailer )
{
@franz-josef-kaiser
franz-josef-kaiser / unset-admin-menu.php
Created April 26, 2011 15:49
How to unset certain admin menu groups in wordpress for specific (named) groups of users.
<?php
/*
Plugin Name:Unset Menu Items
Plugin URI: http://example.com
Description:How to unset certain admin menu groups in wordpress for specific (named) groups of users.
Author: Franz Josef Kaiser
Author URI: http://example.com
Version: 0.1
License: extended MIT/Expat license
@franz-josef-kaiser
franz-josef-kaiser / get_device_template.php
Created March 25, 2011 07:33
Loads a template part incl. the appropriate stylesheet for desktop or mobile devices, based on custom conditional tags.
<?php
/**
* STYLESHEETS
*/
function print_device_styles( $client = 'desktop' )
{
$client = apply_filters( 'set_theme_client', $client );
wp_enqueue_style( $client.'-css' );
}
add_action( 'wp_head', 'print_device_styles', 11 );
@franz-josef-kaiser
franz-josef-kaiser / options_globals-dump.php
Created June 2, 2014 21:13
A WordPress plugin to dump image related globals, options and callbacks on shutdown. Use it in a vanilla WP install with no other plugins activated and an empty theme (style.css and empty index.php only).
<?php
/** Plugin Name: (dev) Options and Globals dump on shotdown */
/**/
add_action( 'shutdown', function()
{
$defaults = wp_load_alloptions();
foreach ( get_intermediate_image_sizes() as $s )
{
@franz-josef-kaiser
franz-josef-kaiser / external_themes_dir.php
Created January 24, 2014 22:31
An external themes directory (above wp root folder) that runs on a separate domain. Best used as mu plugin for your development stack. Greatly simplifies local development. Props: Thomas "toscho" Scholz.
<?php
/* Plugin Name: Local Theme Roots */
/**
* Create a custom theme directory on a custom domain.
* Best used as mu plugin in a local development stack.
*
* @author Thomas Scholz
* @param string $root URL or path
* @return string
@franz-josef-kaiser
franz-josef-kaiser / .bash_profile
Last active September 22, 2023 05:02
QNAP Entware opkg command not found
# .bash_profile
# /share/CACHEDEV1_DATA/.qpkg/container-station/bin location of `docker`/ `docker-compose` binaries
# /opt/bin location where `opkg` binary is installed to.
export PATH=\
/bin:\
/sbin:\
/usr/bin:\
/usr/sbin:\
/usr/bin/X11:\
@franz-josef-kaiser
franz-josef-kaiser / list_plugin_updates.php
Created May 27, 2011 15:59
WordPress Plugin: List all plugins that need updates in wp_footer()
<?php
/*
Plugin Name: Plugin update lister
Plugin URI: https://gist.github.com/995560
Description: Adds a table to your ´wp_footer()´ that lists all plugins that need updates. The plugin works out of the box.
Author: Franz Josef Kaiser
Author URI: https://github.com/franz-josef-kaiser
Version: 0.1.
License: GPL v2 - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html