Skip to content

Instantly share code, notes, and snippets.

Avatar

Mark Root-Wiley mrwweb

View GitHub Profile
@mrwweb
mrwweb / faux-block-editor.css
Last active Feb 10, 2022
CSS to make the Classic Editor look more like the Block Editor
View faux-block-editor.css
/**
* faux-block-editor.css v1.1
*
* Styles to make the Classic Editor screen appear more like the Block Editor
*
* Expects the class "faux-block-editor" on any screen that should use these styles
*/
.faux-block-editor {
overflow-x: hidden;
@ryanwelcher
ryanwelcher / theme.json
Created Feb 8, 2022
When adding theme.json to an existing Classic Theme, these settings will stop the default color and typography controls from being enabled.
View theme.json
{
"$schema": "http://schemas.wp.org/trunk/theme.json",
"version": 2,
"settings": {
"layout": {
"contentSize": "750px"
},
"color": {
"background": false,
"custom": false,
@thomasfw
thomasfw / wpmail-enhanced-attachments.php
Last active Jul 28, 2022
Enable non-filesystem attachments with wp_mail()
View wpmail-enhanced-attachments.php
<?php
/**
* Plugin Name: Enhanced WP Mail Attachments
* Plugin URI: https://gist.github.com/thomasfw/5df1a041fd8f9c939ef9d88d887ce023/
* Version: 0.1
*/
/**
* Adds support for defining attachments as data arrays in wp_mail().
@mrwweb
mrwweb / readme.md
Last active Nov 22, 2022
The Events Calendar v2 Template Reset & Customizations
View readme.md

The Events Calendar v2 Template Reset & Customizations

Version 1.5

Introduction

The Events Calendar is a very powerful WordPress plugin for managing events. However, the way its templates and CSS are implemented—especially in "v2"—leave much to be desired.

This contains all the changes I make on a project for The Events Calendar. Hopefully it's useful. If it saves you an hour, maybe you can buy me a cup of coffee or a beer 🍻

@mrwweb
mrwweb / nested-block-alignments.css
Created Jan 6, 2021
WordPress Block Alignment Classes with Support for Nested Group Blocks
View nested-block-alignments.css
.block-container > *, /* [1] */
.wp-block-group__inner-container > * { /* [2] */
max-width: 46.25rem;
margin-left: 1.25rem;
margin-right: 1.25rem;
@media (min-width: 48.75em) { /* [3] */
margin-left: auto;
margin-right: auto;
}
@djrmom
djrmom / custom-hooks.php
Created Apr 17, 2020
facetwp archive query main query
View custom-hooks.php
<?php
/** make sure facet always targets the archive query as the main query
** sometimes there is a mysterious extra query that is a duplicate
** of the main query
**/
add_filter( 'pre_get_posts', function( $query ) {
if ( $query->is_archive() && $query->is_main_query() ) {
$query->set( 'facetwp', true );
}
}, 9 );
@samkent
samkent / dequeue-tribe-events-styles-scripts.php
Last active Apr 14, 2022
Dequeue Tribe Events (The Events Calendar) scripts and styles if not calendar or event page
View dequeue-tribe-events-styles-scripts.php
<?php
/**
* Detect Tribe Events page
* @link https://wordpress.stackexchange.com/questions/340515/writing-a-function-to-detect-an-event
*/
function is_tribe_calendar() {
if (tribe_is_event() || tribe_is_event_category() || tribe_is_in_main_loop() || tribe_is_view() || 'tribe_events' == get_post_type() || is_singular( 'tribe_events' )) {
return true;
}
else {
@pestbarn
pestbarn / IE11-grid-with-autoprefixer.md
Last active Jan 23, 2019
CSS Grid for IE11 using Autoprefixer
View IE11-grid-with-autoprefixer.md

About: CSS Grid for IE11

CSS Grid in IE11 is an implementation based on the 2011 spec, which means we aren't really able to use grids out of the box according to the newer spec. However, Autoprefixer automates a lot of work for us with getting the correct IE11 properties, and it has support for most (if not all?) -ms-grid properties.

There are still some gotchas which Autoprefixer can't help with though:

  • There is no auto-placement behaviour in the 2011 spec. This means that for IE11, you have to position everything. rather than use the autoplacement ability of grid.
  • Using minmax() with an auto value is not supported, and will break things - e.g. minmax(auto, 1200px) will not work. To use minmax, you have to specify two positive values - e.g. minmax(500px, 1200px).
  • grid-gap properties were added in a later spec. To create grid-gaps in IE11, you will need to create separate
@jdelia
jdelia / code-functions.php
Last active Aug 2, 2018
SVG Icons and Graphic Elements
View code-functions.php
// Add the SVG icons functions.
include_once( get_stylesheet_directory() . '/lib/icon-functions.php' );
@trepmal
trepmal / toggle-debug.php
Last active Sep 4, 2020
WordPress experiment. Toggle debug from admin bar
View toggle-debug.php
<?php
/*
Plugin Name: Toggle Debug
Description: Proof-of-concept for an admin-bar debug mode toggle. Needs some UX love.
*/
/*
// In wp-config.php, wrap debug constants in a cookie conditional
if ( isset( $_COOKIE['wp-debug'] ) && $_COOKIE['wp-debug'] == 'on' ) {
define('WP_DEBUG', true);
}