Skip to content

Instantly share code, notes, and snippets.

View MichaelVanDenBerg's full-sized avatar
🏠
Working from home

Michael van den Berg MichaelVanDenBerg

🏠
Working from home
View GitHub Profile
@pitch-gist
pitch-gist / gist:2999707
Created June 26, 2012 22:21
HTML: Simple Maintenance Page
<!doctype html>
<title>Site Maintenance</title>
<style>
body { text-align: center; padding: 150px; }
h1 { font-size: 50px; }
body { font: 20px Helvetica, sans-serif; color: #333; }
article { display: block; text-align: left; width: 650px; margin: 0 auto; }
a { color: #dc8100; text-decoration: none; }
a:hover { color: #333; text-decoration: none; }
</style>
@BronsonQuick
BronsonQuick / count_number_of_widgets_wordpress.php
Created July 19, 2012 01:46
Count the number of widgets in a sidebar in WordPress
<?php
/**
* Count the number of widgets in a sidebar
* Works for up to ten widgets
* Usage <?php ctm_sidebar_class( 'promo' ); ?> where promo is the name of the sidebar
*/
function ctm_sidebar_class( $sidebar_name ) {
global $sidebars_widgets;
$count = count ($sidebars_widgets[$sidebar_name]);
@wycks
wycks / image_optimize-wordpress.php
Last active December 16, 2020 01:48
Remove WordPress full size images from being inserted into a post + option to and add max size to to prevent users from inserting massive images.
<?php
/**
*
* This removes the ability to add the FULL image size into a post, it does not alter or delete the image
* Add whataever extra image sizes to the insert dropdown in WordPress you create via add_image_size
*
* For now we have to do it this way to make the labels translatable, see trac ref below.
*
* If your theme has $content_width GLOBAL make sure and remove it
@millermedeiros
millermedeiros / osx_setup.md
Last active June 26, 2024 22:08
Mac OS X setup

Setup Mac OS X

I've done the same process every couple years since 2013 (Mountain Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've done it.

I kinda regret for not using something like Boxen (or anything similar) to automate the process, but TBH I only actually needed to these steps once every couple years...

@justintadlock
justintadlock / customize-control-background-image.php
Created October 14, 2013 01:23
Class for registering multiple default backgrounds in WrodPress themes.
<?php
/**
* Extends the WordPress background image customize control class, which allows a theme to register
* multiple default backgrounds for the user to choose from. To use this, the theme author
* should remove the 'background_image' control and add this control in its place.
*
* @since 0.1.0
* @author Justin Tadlock <justin@justintadlock.com>
* @copyright Copyright (c) 2013, Justin Tadlock
* @link http://justintadlock.com/archives/2013/10/13/registering-multiple-default-backgrounds
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@staltz
staltz / introrx.md
Last active July 4, 2024 10:11
The introduction to Reactive Programming you've been missing
@gregrickaby
gregrickaby / functions.php
Last active August 29, 2015 14:03
How to create an Author Box using the Gravatar API
<?php
// DO NOT INCLUDE OPENING PHP TAG AND PLACE INTO FUNCTIONS.PHP
/**
* Get Author's Gravatar profile data.
*/
function custom_get_gravatar_profile() {
// Get author data
$author = strtolower( trim( get_the_author_meta( 'email' ) ) );
@Freekbron
Freekbron / fa-icon-walker.php
Created November 11, 2014 10:07
Font Awesome - WordPress - Custom nav walker
<?php
/**
* Custom nav walker
*
* Custom nav walker to assign icons to menu items.
*/
class FA_Icon_Walker extends Walker_Nav_Menu
{
/**
@devinsays
devinsays / combine-menus.php
Created November 13, 2015 18:09
Combines two WordPress menus into one.
<?php
/**
* Combines the markup of two menu areas into one.
*/
// Get the markup list items in the first menu.
$menu = wp_nav_menu( array(
'theme_location'=> 'menu-1',
'fallback_cb' => false,
'container' => '',