Skip to content

Instantly share code, notes, and snippets.

View acki's full-sized avatar
👋
I may be slow to respond.

Christoph S. Ackermann acki

👋
I may be slow to respond.
View GitHub Profile
@acki
acki / mu-autoloader.tpl.php
Created February 22, 2018 13:16
WordPress MU Plugins autoloader
<?php
/**
* This file is for loading all mu-plugins within subfolders
* where the PHP file name is exactly like the directory name + .php.
*
* Example: /mu-tools/mu-tools.php
*/
$dirs = glob(dirname(__FILE__) . '/*' , GLOB_ONLYDIR);
// Lade erst wenn Dokument und Elemente ready
jQuery(function() {
// Für alle Bilder mit der Klasse .person-img...
jQuery('.person-img').each( function( image ) {
// Bilder preload im Hintergrund
imageObj = new Image();
imageObj.src = jQuery(this).attr('src').replace(/_flat/g, '_pic');
// Mouseover Funktionsbinding
jQuery(this).live('mouseover', function() {
@acki
acki / helpers.php
Last active January 20, 2019 18:21
Helper for saving queries when using ACF in WordPress
<?php
// get field function for ACF without using ACF and generating additional queries (normally)
function get( $selector, $post_id = false, $format_value = true ) {
if( function_exists( 'get_post_meta' ) && function_exists( 'acf_get_valid_post_id' ) ) {
$post_id = acf_get_valid_post_id( $post_id );
// Search the data in post meta