Skip to content

Instantly share code, notes, and snippets.

View graylaurenm's full-sized avatar

Lauren Gray graylaurenm

View GitHub Profile
@graylaurenm
graylaurenm / functions.php
Last active May 14, 2018 21:15
Genesis infinite scroll, supporting column classes, custom settings by page, and both auto + button loading
<?php
/**
*
* Infinite Scroll
*
* @since 1.0.0
*
* @author Lauren Gray
* @author Bill Erickson
@graylaurenm
graylaurenm / block-column.css
Last active September 3, 2018 15:11
Gutenberg
/* Support column layouts. */
.wp-block-columns .wp-block-column {
margin-left: 12px;
}
.has-2-columns .wp-block-column:nth-of-type(2n+1),
.has-3-columns .wp-block-column:nth-of-type(3n+1),
.has-4-columns .wp-block-column:nth-of-type(4n+1),
.has-5-columns .wp-block-column:nth-of-type(5n+1),
.has-6-columns .wp-block-column:nth-of-type(6n+1) {
<?php
add_filter( 'tasty_recipes_recipe_template_vars', __NAMESPACE__ . '\replace_tasty_image_size', 10, 2 );
function replace_tasty_image_size( $template_vars, $recipe ) {
$recipe_json = $recipe->to_json();
$template_vars['recipe_image'] = ! empty( $recipe_json['image_sizes']['placement-recipe'] ) ? $recipe_json['image_sizes']['placement-recipe']['html'] : '';
return $template_vars;
}
@graylaurenm
graylaurenm / snippet.php
Created March 4, 2024 19:07
Custom WPForms smart tag for WP Recipe Maker
/**
* Register the Smart Tag so it will be available to select in the form builder.
*
*/
add_filter( 'wpforms_smart_tags', 'oc_register_smarttag', 10, 1 );
function oc_register_smarttag( $tags ) {
$tags[ 'recipe' ] = 'Recipe';
return $tags;
@graylaurenm
graylaurenm / block.html
Created March 5, 2024 14:40
Starter block for recipe post save for later
<!-- wp:group {"style":{"color":{"background":"#f4f4f4"},"spacing":{"padding":{"top":"2rem","bottom":"2rem","left":"2rem","right":"2rem"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group has-background" style="background-color:#f4f4f4;padding-top:2rem;padding-right:2rem;padding-bottom:2rem;padding-left:2rem"><!-- wp:heading -->
<h2 class="wp-block-heading">Email me this recipe</h2>
<!-- /wp:heading -->
<!-- wp:paragraph -->
<p>Thinking about making this recipe? Save it for later by emailing yourself a copy.</p>
<!-- /wp:paragraph -->
<!-- wp:group {"backgroundColor":"base-2","layout":{"type":"flex","flexWrap":"nowrap","orientation":"horizontal","justifyContent":"space-between"}} -->
@graylaurenm
graylaurenm / find.txt
Last active April 25, 2024 19:03
WPRM: convert fallback HTML (when migrating from Tasty Recipes) to block
/(<!--WPRM Recipe (\d+)-->.*<!--End WPRM Recipe-->)(?!.*<!-- \/wp:wp-recipe-maker\/recipe -->)/s
@graylaurenm
graylaurenm / srcset.php
Created February 26, 2018 18:21
Cool things we can do with srcset in themes...
<?php
/**
* When using thumbnails, anything using the chosen
* thumbnail size should adjust their srcset sizes to
* match. This assumes image sizes are always precise and
* used in the same layouts/collapse.
*
* In this case, the chosen image is 222px wide on larger
* screens and about 29-31% of the viewport on smaller.