Skip to content

Instantly share code, notes, and snippets.

View Dorf's full-sized avatar

David Smyth Dorf

View GitHub Profile
@Dorf
Dorf / functions.php
Created October 16, 2023 13:02
[remove Jetpack nag in Woocommerce] #woo #mu-plugin #nag
add_filter( 'jetpack_just_in_time_msgs', '__return_false' );
@Dorf
Dorf / mu-remove.php
Created July 15, 2023 18:08
[Remove Blocks in Gutenberg] add to mu or functions #php #gutenberg #wordpress
/*
* Blacklist specific Gutenberg blocks
*
* @author Misha Rudrastyh
* @link https://rudrastyh.com/gutenberg/remove-default-blocks.html#blacklist-blocks
* @link https://wpturbo.dev/disable-wordpress-blocks/
*/
add_filter( 'allowed_block_types_all', 'misha_blacklist_blocks' );
function misha_blacklist_blocks( $allowed_blocks ) {
@Dorf
Dorf / wp-config.php
Last active November 8, 2022 15:54
[wp-config local] basic setup #wp #wp-config #wordpress #setup
define( 'WP_CACHE', false );
// define( 'WP_ENVIRONMENT_TYPE', 'development' );
define( 'WP_ENVIRONMENT_TYPE', 'local' ); // https://wordpress.org/plugins/display-environment-type/
/* Modified directories can be used for version control */
define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] ); // alt: define( 'WP_HOME', 'https://' . $_SERVER['HTTP_HOST'] . '/path/to/wordpress' );
define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] ); // alt: define( 'WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST'] . '/path/to/wordpress' );
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/path/to/wp-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/path/to/wp-content' );
define( 'UPLOADS', 'media' );
@Dorf
Dorf / gf_form_notification.txt
Created September 2, 2022 15:05
[Gravity Forms Admin Notice Text] Copy/Paste boilerplate admin notice #wordpress #gravityforms #notifications #boilerplate
This was submitted on: {embed_url}
All form submissions can be viewed at: https://domain.com/wp-admin/admin.php?page=gf_entries&id=1
Below is all the info submitted.
{all_fields}
 
@Dorf
Dorf / mundopepsi.com-mobile_2022-08-19.lighthouse.report.json
Last active August 19, 2022 22:10
[Mundo Pepsi Lighthouse Mobile | web.dev/measure] homepage Aug 19 https://googlechrome.github.io/lighthouse/viewer/?gist=7a08ccf09e6b6eda6dabe1e968db013d #lighthouse #audit #pepsi #mobile
{
"requestedUrl": "https://mundopepsi.com/",
"finalUrl": "https://mundopepsi.com/",
"lighthouseVersion": "9.6.5",
"userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/102.0.5005.115 Safari/537.36",
"fetchTime": "2022-08-19T22:04:40.374Z",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Linux; Android 7.0; Moto G (4)) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4695.0 Mobile Safari/537.36 Chrome-Lighthouse",
"hostUserAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/102.0.5005.115 Safari/537.36",
"benchmarkIndex": 1680.5
@Dorf
Dorf / mundopepsi.com_2022-08-19.lighthouse.report.json
Last active August 19, 2022 22:01
[Mundo Pepsi Lighthouse Desktop | local] homepage Aug 19 https://googlechrome.github.io/lighthouse/viewer/?gist=b7622014f0d4a30cbf0e882b80c53bd0 #lighthouse #audit #pepsi #desktop
{
"lighthouseVersion": "9.6.1",
"requestedUrl": "https://mundopepsi.com/",
"finalUrl": "https://mundopepsi.com/",
"fetchTime": "2022-08-19T20:37:06.772Z",
"gatherMode": "navigation",
"runWarnings": [],
"userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
"environment": {
"networkUserAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4695.0 Safari/537.36 Chrome-Lighthouse",
@Dorf
Dorf / .eslintrc.js
Created February 28, 2019 03:11
[ESLint adjustments for developemt] update rules to warning or disable, add to root sage theme file #sage #development
module.exports = {
'root': true,
'extends': 'eslint:recommended',
'globals': {
'wp': true,
},
'env': {
'node': true,
'es6': true,
'amd': true,
@Dorf
Dorf / admin.php
Last active May 3, 2021 06:59
[Roots Sage starting admin functions] add Color Palette, Gutenberg editor styles, and basic Intervention commands #sage #roots #admin #intervention #gutenberg #editor
<?php
/**
* Admin assets
*/
add_action('admin_enqueue_scripts', function () {
// global $post;
// $my_post_type = 'page';
if ( stristr( $_SERVER['REQUEST_URI'], 'post.php' ) !== false // just for the post editor
// && is_object( $post )
@Dorf
Dorf / faqs.blade.php
Last active February 2, 2024 17:02
[Shortcodes in Sage] Example for FAQs #sage #blade #shortcodes #partials
///////////////////////////
// /resources/views/partials/shortcodes/faqs.blade.php
<ul class="accordion span12" data-allow-all-closed="true" data-deep-link="true" data-deep-link-smudge="true" data-deep-link-smudge-delay="600" data-accordion id="deeplinked-accordion-with-smudge">
@foreach($faqs as $faq)
<li class="accordion-item" data-accordion-item>
<a href="#{{ $category }}{{ $loop->iteration }}" class="accordion-title">{!! $faq->post_title !!}</a>
<div class="accordion-content" data-tab-content id="answer{{ $loop->iteration }}">
{!! $faq->post_content !!}
</div>
</li>
@Dorf
Dorf / controller.page.php
Last active February 13, 2019 15:03
[Controller Page functions for Roots / Sage] #controller #sage #roots #functions #page #laravel
class Page extends Controller
{
// Pass on all fields from Advanced Custom Fields to the view
protected $acf = true;
// Pass on only field_1 from Advanced Custom Fields to the view
// protected $acf = 'project_intro_fields';
// Pass on multiple fields from Advanced Custom Fields to the view
// protected $acf = ['field_1', 'field_2'];