Skip to content

Instantly share code, notes, and snippets.

View addisonhall's full-sized avatar

Addison Hall addisonhall

View GitHub Profile
@diggeddy
diggeddy / custom-loop-shortcode-gpp.php
Last active December 26, 2021 20:49
Custom Loop Shortcode for displaying a GPP Content Template
<?php
function db_custom_loop_shortcode($atts, $content = null) {
global $post;
// Set query args
$args = array(
'post_type' => 'post',
'posts_per_page' => '3',
'post__not_in' => array( $post->ID ), // don't display current post
);
// Optional arguments for setting category term relationship on single post
@adactio
adactio / minimal-serviceworker.js
Last active August 18, 2023 09:15
An attempt at a minimal viable service worker.
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
// HTML files: try the network first, then the cache.
// Other files: try the cache first, then the network.
// Both: cache a fresh version if possible.
// (beware: the cache will grow and grow; there's no cleanup)
const cacheName = 'files';
@addisonhall
addisonhall / content-cpt-output-list.php
Last active November 4, 2017 20:21
WordPress shortcode example: output custom post type list by custom taxonomy
<?php
/**
* Partial for custom_post_type_list shortcode output.
*
* @package ChildTheme
*/
if ( ! defined( 'ABSPATH' ) ) exit; ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
@richjenks
richjenks / web.config
Created December 13, 2014 08:57
GetSimple fancy URLs on IIS Windows Server
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<rewrite>
<rules>
<rule name="GetSimple Fancy URLs" stopProcessing="true">
<match url="/?([A-Za-z0-9-_]+)/?$" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
@anthonyholmes
anthonyholmes / bootstrap-sass-mixin-cheatsheet.scss
Created October 10, 2014 08:13
Bootstrap Sass Mixin Cheatsheet
// Alerts
@include alert-variant($background, $border, $text-color);
// Background Variant
@include bg-variant($parent, $color);
// Border Radius
@include border-top-radius($radius);
@include border-right-radius($radius);
@include border-bottom-radius($radius);
@mbijon
mbijon / wordpress-remove-media_buttons.php
Last active July 10, 2023 23:30
Remove 'Add Media' button from above WP editor, per post-type
function check_post_type_and_remove_media_buttons() {
global $current_screen;
// use 'post', 'page' or 'custom-post-type-name'
if( 'post' == $current_screen->post_type ) add_action( 'media_buttons_context' , create_function('', 'return;') );
}
add_action('admin_head','check_post_type_and_remove_media_buttons');
@Zodiac1978
Zodiac1978 / .htaccess
Last active March 15, 2024 08:29
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
# https://andreashecht-blog.de/4183/