Skip to content

Instantly share code, notes, and snippets.

View SteveRyan-ASU's full-sized avatar

Steve Ryan SteveRyan-ASU

  • Arizona State University, Fulton Schools of Engineering Communications (@fsoe-asu)
  • Tempe, AZ
View GitHub Profile
@SteveRyan-ASU
SteveRyan-ASU / acf_blockspacing.php
Created December 5, 2022 17:45
ACF Blocks: Render block spacing string for inline style
/**
* Given an $block object from an ACF block for gutenberg,
* This will return a string of CSS inline values suitable for
* inclusion in the block output in PHP.
*
* @param mixed $block
* @return $style as string
*/
function acf_blocks_calculate_spacing($block) {
@SteveRyan-ASU
SteveRyan-ASU / blocktest.html
Created July 19, 2019 22:06
Block Unit Test for Gutenberg. No plugin required
<!-- wp:paragraph -->
<p>Donec id elit non mi porta gravida at eget metus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec ullamcorper nulla non metus auctor fringilla.</p>
<!-- /wp:paragraph -->
<!-- wp:more -->
<!--more-->
<!-- /wp:more -->
<!-- wp:separator -->
<hr class="wp-block-separator"/>
@SteveRyan-ASU
SteveRyan-ASU / gf-readymade-css-classes.md
Created June 24, 2019 21:11
Gravity Forms Ready-Made CSS classes

CSS Ready Classes

Halves (2 Columns):

  • gf_left_half
  • gf_right_half

Thirds (3 Columns):

  • gf_left_third
@SteveRyan-ASU
SteveRyan-ASU / asu-gravity-forms.css
Last active April 1, 2020 21:24
Lightweight CSS rules for delivering a form via Gravity Forms that looks halfway decent.
// Substitute your own ID for the form that you want to style.
// Working example is here: https://faculty-resources.engineering.asu.edu/ Workshop page.
#gform_wrapper_1 {
background-color:#e0e0e0;
padding:2em;
color:#000000;
}
@SteveRyan-ASU
SteveRyan-ASU / asu-divi-patch-filter-blog-module.php
Last active June 30, 2018 07:20
Recommended patch from ET to produce square featured images for blog module posts.
<?php
/**
* Plugin Name: ASU Divi - ET Patch, Square Featured Images for Blog Module
* Plugin URI: https://gist.github.com/SteveRyan-ASU/e129e2f68e1867875a0c23597ac85a06/edit
* Description: Recommended patch from ET to produce square featured images for blog module posts.
* Author: Steve Ryan, ASU Engineering
* Author URI: https://engineering.asu.edu
* Version: 0.1
*
*/
@SteveRyan-ASU
SteveRyan-ASU / terminus_sitelist_by_upstream.sh
Created June 6, 2018 16:34
Terminus loop for creating a list of sites by upstream ID.
for site in $(terminus org:site:list --field Name <org>);do
if [[ ! -z $(terminus site:info --field Upstream $site | grep -o <upstream id>) ]];then
echo $site
fi
done
@SteveRyan-ASU
SteveRyan-ASU / redirect-from-json.php
Created January 31, 2018 17:14
Pantheon: Redirect via JSON feed in private file section
// PHP snippet included in wp-config.php (or settings.php).
// Including from that location in a separate file is OK as well.
<?php
// Remove any leading "www." from the host name.
$redirect_host = str_replace('www.', '', $_SERVER['HTTP_HOST']);
$redirect_path = strtolower(rtrim($_SERVER['REQUEST_URI']));
if (strlen($redirect_path) > 2) {
$redirect_path = rtrim($redirect_path, '/');
}