Skip to content

Instantly share code, notes, and snippets.

View landbryo's full-sized avatar
🤠
Always Excitied

Landon Otis landbryo

🤠
Always Excitied
View GitHub Profile
@landbryo
landbryo / wp-playground-stream.json
Last active July 16, 2024 17:03
WordPress Playground - Stream
{
"preferredVersions": {
"php": "8.2",
"wp": "latest"
},
"phpExtensionBundles": [
"kitchen-sink"
],
"siteOptions": {
"blogname": "Stream Playground"
@landbryo
landbryo / enable-dropcap.php
Created December 20, 2023 18:19
Enable the dropcap feature by modifying the theme.json
<?php
/**
* Add drop cap support to the theme.json file.
*
* @param array $theme_json The theme.json json.
*
* @link https://developer.wordpress.org/block-editor/developers/themes/theme-json/#typography
*/
add_filter( 'wp_theme_json_data_theme', function( $theme_json ) {
@landbryo
landbryo / modify-paragraph-controls.js
Created December 20, 2023 18:15
Modify paragraph controls to add "Lead" and "Endmark" toggles.
import { createHigherOrderComponent } from '@wordpress/compose';
import { InspectorControls } from "@wordpress/block-editor";
import { __experimentalToolsPanelItem as ToolsPanelItem, ToggleControl, } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
const editParagraphAttributes = function ( settings, name ) {
if ( 'core/paragraph' === name ) {
settings.supports = {
...settings.supports,
@landbryo
landbryo / sample-getty-image-meta.json
Created December 12, 2023 15:35
Sample Getty Image Metadata
{
"width": 612,
"height": 408,
"file": "2023/12/gettyimages-1463514722-612x612-1.jpg",
"filesize": 82069,
"sizes": {
"medium": {
"file": "gettyimages-1463514722-612x612-1-300x200.jpg",
"width": 300,
"height": 200,
@landbryo
landbryo / disable-login-cookie-bookmarket.js
Created October 16, 2023 22:39
Disable Login Cookie Bookmarklet
@landbryo
landbryo / enable-login-cookie-bookmarklet.js
Created October 16, 2023 22:38
Enable Login Cookie Bookmarklet
@landbryo
landbryo / additional-authors-partial.php
Created October 16, 2023 18:07
Filter posts SQL query to include additional authors.
<?php
/**
* Hooks
*
* @return void
*/
public function init() {
// Filter author query to include posts author was added to as an additional author.
add_filter( 'posts_where', [ $this, 'filter_where' ], 10, 2 );
@landbryo
landbryo / gravity-complex-calculation.md
Last active September 9, 2023 20:18
Example Gravity Form Complex Calculation

Complex calculations in Gravity Forms may not work in the order that you'd expect. In this scenario, instead of subtracting the total value of the calculations from the value of field 15, we have to force the order of operation by subtracting it at the end, which creates a negative number. To return the number to positive, we multiply the total value by -1.

(
    ( {:15} * ( {:3} * 0.01 ) ) + 
    ( {:15} * ( {:16} * 0.01 ) ) + 
    ( {:15} * ( {:17} * 0.01 ) ) + 
    ( {:15} * ( {:7} * 0.01 ) ) - 
    ( {:15} ) 
) * -1
@landbryo
landbryo / mrss-example-item-description-cdata.xml
Created September 5, 2023 22:12
Example mRSS feed using non-spec custom parameters
<item>
<link>https://www.nerdwallet.com/article/mortgages/fthb-affordability-q22023</link>
<guid>https://www.nerdwallet.com/article/mortgages/fthb-affordability-q22023</guid>
<description>
<![CDATA[
<p>This second quarter analysis finds high rates and higher prices made for another tough quarter for potential first-time home buyers.</p>
<ul>
<li>
<a href="https://www.drsquatch.com">Sasquatch Found Working at Arbys</a>
@landbryo
landbryo / mrss-example-item-custom-parameters.xml
Last active September 5, 2023 22:23
Example mRSS feed item using non-spec custom parameters
<item>
<link>https://www.nerdwallet.com/article/mortgages/fthb-affordability-q22023</link>
<guid>https://www.nerdwallet.com/article/mortgages/fthb-affordability-q22023</guid>
<description>This second quarter analysis finds high rates and higher prices made for another tough quarter for potential first-time home buyers.</description>
<pubDate>Tue, 5 Sep 2023 06:00:00 +0000</pubDate>
<category>Mortgages</category>
<title>First-Time Home Buyer Metro Affordability Report — Q2 2023</title>
<media:content url="https://placehold.co/3840x2160.mp4?text=Hello+World" type="video/mp4">
<media:thumbnail url="https://placehold.co/600x400" type="image/jpg"/>
<media:description type="plain">Hello world over a gray square</media:description>