Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@atomtigerzoo
atomtigerzoo / wordpress-disable-yoast-seo-on-custom-post-type.php
Created March 31, 2016 12:39
Wordpress: Disable Yoast SEO on Custom Post Type
function my_remove_wp_seo_meta_box() {
remove_meta_box('wpseo_meta', YOUR_POST_TYPE_NAME_HERE, 'normal');
}
add_action('add_meta_boxes', 'my_remove_wp_seo_meta_box', 100);
@atomtigerzoo
atomtigerzoo / check-mount-point.sh
Created July 11, 2018 09:01
Simple bash script to check if a mount point has been mounted, and if not, re-mount it or notify someone via email
#!/bin/bash
MOUNTPOINT="/some/mount-point"
EMAIL="root@your-domain.example.com"
if cat /proc/mounts | grep ${MOUNTPOINT} > /dev/null; then
echo "${MOUNTPOINT} already mounted."
exit 0
fi
@atomtigerzoo
atomtigerzoo / gist:d2524a5d1b60fb072c1991e4337461c1
Created October 17, 2023 16:02
zsh-oh-my-zsh_show-notice-on-directory-change
# The following goes into .zshrc and need zsh/oh my zsh installed
# Watch folder changes
function chpwd {
if [[ -e .nvmrc ]]; then
# If above file is found inside folder, display the following
echo
echo ✨ nvmrc dotfile found
echo ✨ Please execute \`nvm use\` to use\/install the correct node version!
echo
@atomtigerzoo
atomtigerzoo / wordpress-split-content-at-more-shortcode.php
Last active August 30, 2023 05:41
Wordpress: split the_content into parts at more-shortcode
function atz_split_content_at_more(){
// Split the content
$content_parts = preg_split('/<span id="more-\d+"><\/span>/i', get_the_content());
// Grab first part of content and apply filters
$result['intro'] = apply_filters('the_content', array_shift($content_parts));;
// Content has a more part?
if(!empty($content_parts)):
$result['more'] = apply_filters('the_content', implode($content_parts));

Create private networks with libvirt

I assume that you have a running debian wheezy host with libvirt and qemu/kvm installed. You need two guest VMs for this. The first guest will get the IP 192.168.100.2 and the second will get 192.168.100.100. All following commands must be run with sudo or under root.

Internal Network

We create a new network named internal with libvirt and use it with the IP

<?php
/*
This specific case creates a new route/URl to display Wordpress
posts from a fixed category with a parameter-based taxonomy
term with a custom template.
Needs template file: custom-template_category-tax_term.php
Inside the template you can fetch the query-var with:
$wp_query->get('my_tax_query_var')
@atomtigerzoo
atomtigerzoo / wordpress-hide-editor-on-pages.php
Last active December 29, 2020 17:25 — forked from ramseyp/hide-editor.php
Wordpress: Hide the editor on defined pages
/**
* Hide the main editor on specific pages
*/
define('EDITOR_HIDE_PAGE_TITLES', json_encode(array()));
define('EDITOR_HIDE_PAGE_TEMPLATES', json_encode(array('template-cars.php')));
/**
* Hide the main editor on defined pages
*
@atomtigerzoo
atomtigerzoo / virtualbox-with-shared-folder-for-node.md
Last active May 27, 2020 13:22
Virtualbox on Windows 7/Windows 10: Use npm/nodejs within a shared folder

Do not create a shared folder in settings/before - it will be created in step 3!

Enable symlinks for your VM

Open Windows PowerShell with adminstrator rights, enter:

$ VBoxManage setextradata YOURVMNAME VBoxInternal2/SharedFoldersEnableSymlinksCreate/YOURSHAREFOLDERNAME 1

Check if it got set:

$ VBoxManage getextradata YOURVMNAME enumerate

@atomtigerzoo
atomtigerzoo / functions-oembed.php
Last active May 18, 2020 13:12
Wordpress: responsive oembeds - youtube, vimeo, images, etc
/*
Creates a container around embeds
*/
function responsive_embed_wrapper($content) {
return '<figure class="oembed-wrap">' . $content . '</figure>';
}
add_filter('embed_oembed_html', 'responsive_embed_wrapper', 10, 3);
@atomtigerzoo
atomtigerzoo / plain-css-sticky-footer.css
Created March 2, 2020 16:08
Create a sticky footer with Tailwindcss (or just with plain CSS)