Skip to content

Instantly share code, notes, and snippets.

View electricbrick's full-sized avatar

Tom Finley electricbrick

View GitHub Profile
@chrismcintosh
chrismcintosh / acf_populate_custom_tax.php
Last active April 30, 2017 15:59
Some boilerplate code for populating an ACF select box with custom taxonomies and then querying a custom post type using the result of that select box.
<?php
/*
Assumes a custom post type called 'staff'
Assumes that there is a custom taxonomy called 'department'.
Every department that has at least one staff member assigned to it will
populate a select field that is specified in Advanced Custom Fields.
Using that Select field we can then do a query on a custom post type
in this case staff and grab only the staff with our selected department.
@machouinard
machouinard / acf-rules.php
Created October 12, 2016 01:53
Custom ACF location rule for The Events Calendar Event category
<?php
//* Add custom location rule type to column one for selecting an Event category
add_filter( 'acf/location/rule_types', 'mc_location_rule_types' );
function mc_location_rule_types( $choices ) {
$choices['Events']['event_type'] = 'Event Type';
return $choices;
@amboutwe
amboutwe / yoast_seo_admin_remove_columns.php
Last active February 1, 2024 16:37
Remove Yoast SEO columns from posts and pages
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Remove Yoast SEO Columns
* Credit: Andrew Norcross http://andrewnorcross.com/
* Last Tested: Jun 09 2020 using Yoast SEO 14.3 on WordPress 5.4.1
*
* If you have custom post types, you can add additional lines in this format
* add_filter( 'manage_edit-{$post_type}_columns', 'yoast_seo_admin_remove_columns', 10, 1 );
* replacing {$post_type} with the name of the custom post type.
@srikat
srikat / class-custom-featured-post.php
Last active April 3, 2022 16:29 — forked from GaryJones/readme.md
Custom Featured Posts Widget plugin: Skeleton for amending the output of the Genesis Featured Posts widget. https://sridharkatakam.com/custom-featured-post-widget-plugin/
<?php
/**
* Plugin Name
*
* @package Custom_Featured_Post_Widget
* @author Gary Jones
* @license GPL-2.0+
* @link http://gamajo.com/
* @copyright 2013 Gary Jones, Gamajo Tech
*/
@srikat
srikat / functions.php
Created August 19, 2016 06:18
Change skiplinks heading tag from h2 to h1 in Genesis
remove_action ( 'genesis_before_header', 'genesis_skip_links', 5 );
add_action ( 'genesis_before_header', 'sk_skip_links', 5 );
/**
* Add skiplinks for screen readers and keyboard navigation
*
* @since 2.2.0
*/
function sk_skip_links() {
if ( ! genesis_a11y( 'skip-links' ) ) {
@ashander
ashander / unfavorite.js
Last active December 7, 2022 01:37
Delete all your favorites (unfavorite or unlike every tweet) on twitter.com (thx to @JamieMason and @b44rd for inspiring this)
// 1. Go to https://twitter.com/i/likes
// 2. Keep scrolling to the bottom repeatedly until all your favs are loaded.
// 3. Run this in your console (open in chrome by View > Developer > JavaScript Console)
// Notes: this may take a while if you have a lot of favs/likes
// you can only access your most recent ~2000 likes.
// inspired by https://gist.github.com/JamieMason/7580315
$('.ProfileTweet-actionButtonUndo').click()
@stephanieleary
stephanieleary / functions.php
Last active June 5, 2018 20:39
Filter Genesis "no posts found" message
<?php
add_filter( 'genesis_noposts_text', 'my_custom_404_message', 10, 2 );
function my_custom_404_message( $text ) {
$queried_object = get_queried_object();
if ( isset( $queried_object->post_status ) && 'private' == $queried_object->post_status && !is_user_logged_in() )
$text = sprintf( __( 'This page is restricted. Please <a href="%s">log in or register</a>.' ), wp_login_url( $_SERVER['REQUEST_URI'] ) );
elseif ( is_search() )
@stephanieleary
stephanieleary / functions.php
Last active October 8, 2018 16:11
Redirect private page 404 errors to the login screen with a message
<?php
add_action( 'wp', 'my_private_page_404' );
function my_private_page_404() {
$queried_object = get_queried_object();
if ( isset( $queried_object->post_status ) && 'private' == $queried_object->post_status && !is_user_logged_in() ) {
wp_safe_redirect( add_query_arg( 'private', '1', wp_login_url( $_SERVER['REQUEST_URI'] ) ) );
exit;
}
@cmacdonnacha
cmacdonnacha / color-palette.scss
Created April 6, 2016 13:05
Material Design Color Palette
$white: #ffffff;
$black: #000000;
$red50: #ffebee;
$red100: #ffcdd2;
$red200: #ef9a9a;
$red300: #e57373;
$red400: #ef5350;
$red500: #f44336;
$red600: #e53935;
$red700: #d32f2f;