Skip to content

Instantly share code, notes, and snippets.


Mark Root-Wiley mrwweb

View GitHub Profile
mrwweb / reset-rems
Created May 22, 2013 13:22
"Sanity-ize" REMs by setting them to 10px-baseline aka "Tiny Happy Pixels Dancing."
View reset-rems
/* this is the "root" in "root em." */
html {
font-size: 62.5%; /* Now 10px = 1rem! */
body {
font-size: 16px; /* px fallback */
font-size: 1.6rem; /* default font-size for document */
line-height: 1.5; /* a nice line-height */
mrwweb /
Last active May 18, 2023 18:57
The Events Calendar v2 Template Reset & Customizations - Now on Github
mrwweb / replace-helvetica.css
Created May 3, 2023 19:56
CSS to Replace with Segoe UI on Windows - Use a custom CSS add-on in your browser to apply these styles to ALL websites
View replace-helvetica.css
@font-face { font-family: 'helvetica neue'; src: local('Segoe UI'); }
@font-face { font-family: 'helvetica neue'; font-weight:bold; src: local('Segoe UI Bold'); }
@font-face { font-family: 'helvetica neue'; font-weight:bold; src: local('Segoe UI Bold'); }
@font-face { font-family: 'helvetica neue'; font-style: italic; src: local('Segoe UI Italic'); }
@font-face { font-family: 'helvetica neue'; font-style: italic; font-weight:bold; src: local('Segoe UI Bold Italic'); }
@font-face { font-family: 'helvetica'; src: local('Segoe UI'); }
@font-face { font-family: 'helvetica'; font-weight:bold; src: local('Segoe UI Bold'); }
@font-face { font-family: 'helvetica'; font-style: italic; src: local('Segoe UI Italic'); }
@font-face { font-family: 'helvetica'; font-style: italic; font-weight:bold; src: local('Segoe UI Bold Italic'); }
@font-face { font-family: 'HelveticaNeue-Light'; src: local('Segoe UI Light'); }
mrwweb / functions.php
Last active March 18, 2023 04:58
Example Child Theme Files
View functions.php
Make sure to replace {my_} with your theme's unique prefix.
All future functions you write should use that same prefix.
Example: mrwnten_parent_theme_enqueue_styles()
add_action( 'wp_enqueue_scripts', '{my_}parent_theme_enqueue_styles' );
mrwweb / vs-block-variation.css
Created March 3, 2023 20:36
View Source Hello World Block Variation - A little rough around the edges. Tested successfully in the 2023 theme.
View vs-block-variation.css
.wp-block-variation-hello-world {
display: flex;
background: #6fbcac;
padding: 0 !important;
.wp-block-variation-hello-world .wp-block-group__inner-container {
display: flex;
gap: 1em;
mrwweb / fixDiviToggleA11y.php
Last active December 9, 2022 00:01
A small plugin that attempts to fix the accessibility of the Divi Toggle modle. Make sure to read the plugin description for important caveat about the Accordion module (don't use it). Hat tip to Mike Haydon for convincing me this was doable:
View fixDiviToggleA11y.php
* Plugin Name: Fix Divi Toggle Module Accessibility
* Description: Uses JavaScript to insert button in toggle heading, remove tabindex from container, and correctly toggle aria-expanded on toggle button trigger. ⚠ WARNING: This only works for the Toggle module and *BREAKS* the Accordion module (really, it just breaks it more than it was already broken). Therefore, you are encouraged to entirely remove the Accordion module from the site (and the ability for anyone to use it) and only use Toggle modules.
* Author: Mark Root-Wiley, MRW Web Design
* Author URI:
* Version: 1.2.1
namespace MRW\DiviAccordionAria;
mrwweb / tribe_get_events.php
Last active September 28, 2022 16:53
Get Upcoming Events with tribe_get_events()
View tribe_get_events.php
<?php $proj_events = tribe_get_events( array(
'posts_per_page' => 3,
'eventDisplay' => 'list' // only upcoming
), true ); ?>
<?php if( $proj_events->have_posts() ) :
<div class="project-related__block project-related__block--events">
<ul class="bulletless-list">
<?php while( $proj_events->have_posts() ) : $proj_events->the_post(); ?>
mrwweb / mrw-tinymce-filter-example.php
Last active September 1, 2022 19:11
A plugin to modify the TinyMCE editor in WordPress 3.9+. Now available on!
View mrw-tinymce-filter-example.php
* Example filter to add text style to TinyMCE filter with Mark's "MRW TinyMCE Mods" plugin
* Adds a "Text Styles" submenu to the "Formats" dropdown
* This would go in a functions.php file or mu-plugin so you don't have to modify the original plugin.
* $styles array Contains arrays of style_format arguments to define styles.
* Note: Should be an "array of arrays"
mrwweb / button.php
Created August 26, 2022 15:11
Using get_template_part() for Componentized WordPress Themes
View button.php
* $args is available with all values passed in third parameter of get_template_part()
* In a real theme, this would go in something like parts/button.php or components/button.php
* Think carefully about which $args you assume will always be available and which you need to check for
* @link
mrwweb / functions.php
Created June 24, 2020 16:34
Show Hidden Products as Cross-Sells in WooCommerce Cart.
View functions.php
add_filter( 'woocommerce_product_is_visible', 'prefix_show_hidden_product_crosssells', 10, 2 );
function prefix_show_hidden_product_crosssells( $is_visible, $id ) {
if( is_cart() ) {
$is_visible = true;
return $is_visible;