Skip to content

Instantly share code, notes, and snippets.

View smchenrybc's full-sized avatar

Sean McHenry smchenrybc

View GitHub Profile
@smchenrybc
smchenrybc / functions.php
Last active January 17, 2024 18:28
Bug fixes in functions.php
<?php
/**
* functions.php
*/
/**
* Fix a long-standing issue with ACF, where fields sometimes aren't shown
* in previews (ie. from Preview > Open in new tab).
*
* @link https://support.advancedcustomfields.com/forums/topic/custom-fields-on-post-preview/
@smchenrybc
smchenrybc / local-error-handler.php
Last active September 22, 2023 18:58 — forked from bradyvercher/local-error-handler.php
Suppress errors generated by specified WordPress plugins to make developing with debug mode on less painful.
<?php
/**
* Suppress errors generated by specified WordPress plugins.
*
* Include in the auto_prepend_file php.ini directive to ignore globally.
*
* @see http://plugins.trac.wordpress.org/browser/ostrichcize/tags/0.1/ostrichcize.php#L146
*
* @param string $errno The error number.
* @param string $errstr The error message.
@smchenrybc
smchenrybc / context-functions.php
Created July 28, 2023 14:38
Context functions for RiverWoods theme
<?php
/**
* context-functions.php
*
* @package bc_starter
*/
/**
* Get the primary category set in Yoast SEO
*
@smchenrybc
smchenrybc / gist:6f835d159fe2d5885516eb56b68f8bc1
Created April 24, 2023 18:54 — forked from ckpicker/gist:ffe7c737b73e5d581bad
The Events Calendar // Dequeue Styles
function dequeue_tribe_styles() {
// Dequeue events calendar stylesheets
wp_dequeue_style( 'tribe-events-full-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-full-mobile-style' );
wp_dequeue_style( 'tribe-events-calendar-mobile-style' );
wp_dequeue_style( 'tribe-events-full-pro-calendar-style' );
wp_dequeue_style( 'tribe-events-calendar-pro-style' );
wp_dequeue_style( 'tribe-events-calendar-full-pro-mobile-style' );
@smchenrybc
smchenrybc / maintenance.min.css
Created April 13, 2023 18:42
Custom stylesheet for Maintenance Mode plugin: https://wordpress.org/plugins/lj-maintenance-mode
/**
* maintenance.min.css
*/
/* Web Fonts */
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;700&display=swap');
/* Styles */
html {
font-size: 16px;
@smchenrybc
smchenrybc / gist:e690f6a3f32abf90319bf0b118c046f4
Created June 9, 2022 19:24 — forked from jcobb/gist:2993853
Combine multiple WordPress queries
<?php
// An example of creating two separate WP queries, combining the results,
// sorting by date and formatting the results for us in a loop like a regular query.
// order the posts by date in descending order (should go in functions.php to keep things tidy)
function order_by_date( $a, $b )
{
return strcmp( $b->post_date, $a->post_date );
}
@smchenrybc
smchenrybc / LearnGit.txt
Last active September 23, 2021 15:21
Learn X in Y Minutes
$ git init
# Print & Set Some Basic Config Variables (Global)
$ git config --global user.email "MyEmail@Zoho.com"
$ git config --global user.name "My Name"
# Quickly check available commands
$ git help
@smchenrybc
smchenrybc / .htaccess
Last active February 1, 2021 15:39
Security headers in .htaccess file
# BEGIN: SECURITY HEADERS
<ifModule mod_headers.c>
Header always set Strict-Transport-Security: "max-age=31536000" env=HTTPS
Header always set Content-Security-Policy "upgrade-insecure-requests;"
Header always set X-XSS-Protection "1; mode=block"
Header always set X-Content-Type-Options "nosniff"
Header always set Expect-CT "max-age=7776000, enforce"
Header always set Referrer-Policy: "no-referrer-when-downgrade"
</IfModule>
# END: SECURITY HEADERS
@smchenrybc
smchenrybc / flow-error-icu4c-not-loaded.md
Created December 20, 2019 20:54 — forked from berkedel/flow-error-icu4c-not-loaded.md
dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

How to solve dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.60.dylib

brew uninstall --ignore-dependencies node icu4c
brew install node
@smchenrybc
smchenrybc / .zsh_profile
Last active April 29, 2022 20:20
Oh My Zsh setup
###########
# ALIASES #
###########
# Afplay
alias afp='afplay'
# Base64
alias b64="base64"
alias base64='echo `echo "$1" | base64 --decode`'