Skip to content

Instantly share code, notes, and snippets.

Lara Schenck laras126

Block or report user

Report or block laras126

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View single.twig
// See:
$context = Timber::context();
$context['post'] = new Timber\Post();
Timber::render( 'single.twig', $context );
laras126 / a-article-grid.scss
Last active Feb 17, 2019
Article Grid Algorithm
View a-article-grid.scss
// Article Grid
// The Article Grid is a CSS Grid algorithm specifically created for the single article layout.
// It supports a side area called `social` that snaps to the second row on the left at desktop-xl
// in response to `author` becoming a full row. On small screens it is single column.
// The Article Grid algorithm is only responsible for position the _outer most_ elements of
// the single article contents.
// Markup: a-article-grid.html
laras126 /
Last active Feb 12, 2019
Documentation Share: One-offs

One-off Patterns

One-offs patterns are modules that are not parsed into directly into PHP. Their implementation in the pattern library and the production theme are separate. The one-offs here are artifacts of the development process, and are not necessarily up to date with the production version. Their markup files should have a .html extension so that they are not parsed into PHP.

Writing One-off SCSS

When writing styles for a one-off, get as far as you can with utility and algorithm classes, then add additional styles that do not fit into utilities/algorithms in the One-off pattern's SCSS file.

Class names for One-off patterns should have no namespace to indicate they are outside of the design system. For example, a one-off pattern for an author, might have the following styles in 09-one-offs/author/author.scss:

laras126 / parse.php
Created Dec 24, 2018
Possible Twig to PHP parsing
View parse.php
function render_component( $component, $data ) {
$twig_file = CHILD_THEME_PATH . '/assets/src/components/c-' . $component . '/c-' . $component . '.twig';
$template_path = CHILD_THEME_PATH . '/template-parts/components/c-' . $component . '.php';
// This file writing / string manipulation should likely be part of a different program, not the render_component function.
if ( file_exists( $twig_file ) && 0 === validate_file( $twig_file ) ) {
$twig_markup = PMC::render_template( $twig_file, [] );
laras126 / functions.php
Created Dec 9, 2018
Possible way to generate PHP from template syntax
View functions.php
function render_component( $component, $data ) {
// Should be replaced with node_modules path.
$twig_file = CHILD_THEME_PATH . '/assets/src/modules/' . $component . '/' . $component . '.twig';
$template_path = CHILD_THEME_PATH . '/template-parts/pmc-components/' . $component . '.php';
if ( file_exists( $twig_file ) && 0 === validate_file( $twig_file ) ) {
$twig_markup = PMC::render_template( $twig_file, [] );
laras126 / enqueue.php
Last active Dec 24, 2018
Potentially useful way to enqueue bundled assets in WordPress
View enqueue.php
function enqueue_theme_assets() {
// Get the current template and remove the file extension.
global $template;
$template_file = basename( $template );
$bundle_name = str_replace( '.php', '', $template_file );
$template_dir = get_template_directory_uri();
laras126 / config.json
Last active Nov 6, 2018
This might work
View config.json
"dir": {
"input": "./_assets/",
"output": "./dist/assets/"
laras126 / block.js
Last active Apr 14, 2018
WordCamp San Diego 2018, block.js
View block.js
* BLOCK: sponge-block
* Registering a basic block with Gutenberg.
* Simple block, renders and saves the same content without any interactivity.
// Import CSS.
import './style.scss';
import './editor.scss';
laras126 /
Last active Mar 14, 2018
A Gentle Introduction to Gutenberg Development: WordPress Meetup, Pittsburgh; March 13, 2018

A Gentle Introduction to Gutenberg Development

WordPress Meetup, Pittsburgh; March 13, 2018


I'm Lara, not Laura.

@laras126 on Twitter //

laras126 /
Last active Dec 18, 2018
Gutenberg Block Development notes (Hollywood WP Meetup 1-31-18)
You can’t perform that action at this time.