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 / 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>
@landbryo
landbryo / vox-example.json
Last active May 26, 2023 19:15
Example GraphQL Request Returned
{
"data": {
"articles": {
"nodes": [
{
"title": "Elon Musk’s obsession with blue checks is a verified problem",
"body": {
"components": [
{
"__typename": "EntrybodyParagraph",
@landbryo
landbryo / inner-join-w-in.sql
Last active April 24, 2023 19:14
Combine Inner Join and IN to query data from both the posts and postmeta tables.
SELECT post_id,meta_value
FROM db.wp_postmeta
INNER JOIN db.wp_posts ON db.wp_postmeta.post_id = db.wp_posts.ID
WHERE post_type IN('post','page','custom_post_type')
AND meta_key = 'some_meta_key'
AND meta_value
IN(
'item1','item2','item3'
);
@landbryo
landbryo / course-card-block.js
Created April 17, 2023 17:35
Course Card block example.
/**
* WordPress dependencies
*/
import {
InspectorControls,
MediaUpload,
useBlockProps,
} from '@wordpress/block-editor';
import ServerSideRender from '@wordpress/server-side-render';
import { __ } from '@wordpress/i18n';
@landbryo
landbryo / term.js
Created April 17, 2023 17:27
Adds image upload to a single term in the WP admin.
/* global jQuery */
/**
* Styles
*/
import './term.scss';
( () => {
const {
i18n: { __ },
@landbryo
landbryo / author-archive.php
Created April 17, 2023 17:08
Alternative author archive template.
<?php
/**
* The template for displaying author archive pages.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package Plugin_Core
*/
use PluginCore\Authors;
@landbryo
landbryo / Setup.php
Created April 17, 2023 16:40
Plugin setup class template. All client name references replaced with "plugin".
<?php
/**
* Plugin Core setup.
*
* @package Plugin_Core
*/
namespace PluginCore;
/**
@landbryo
landbryo / get-scv-contents.php
Last active March 15, 2023 21:51
Get SCV file contents for use in a PHP template.
<?php
/**
* Setup class.
*/
class Setup {
/**
* Return only one instance of Setup.
*
@landbryo
landbryo / register-meta-array-int.php
Created February 9, 2023 15:16
Register post meta of an array of integers.
<?php
register_post_meta(
'post',
'forage_authors',
[
'type' => 'array',
'description' => 'Additional authors IDs.',
'single' => true,
'sanitize_callback' => null,
@landbryo
landbryo / additional-authors.js
Last active February 13, 2023 14:03
Add additional authors UI.
/**
* WordPress dependencies
*/
import { PluginPostStatusInfo } from '@wordpress/edit-post';
import { useEffect, useMemo, useState } from '@wordpress/element';
import { useDispatch, useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { SelectControl } from '@wordpress/components';
import { decodeEntities } from '@wordpress/html-entities';
import { store as coreStore } from '@wordpress/core-data';