This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Define a block template for a post type that includes a reusable block. | |
* Find the reusable block ID at /wp-admin/edit.php?post_type=wp_block | |
* | |
* @return void | |
*/ | |
add_action('init', function () { | |
$post_type_object = get_post_type_object('page'); // Set the post type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
query NODE_LIST_QUERY($first: Int!, $after: String) { | |
posts(first: $first, after: $after, where: { parent: null }) { | |
nodes { | |
acfFeaturedImage { | |
fieldGroupName | |
scoutFeaturedImageOverride { | |
id | |
sourceUrl | |
} | |
scoutFeaturedImageShow |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mkdir $HOME/bin; wget -O $HOME/bin/wp https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && chmod +x $HOME/bin/wp && echo "export PATH=$HOME/bin:$PATH" | tee -a $HOME/.bashrc && source $HOME/.bashrc; wp --info |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{-- | |
$image: ACF image field | |
$images: \App\get_image_sizes($image_id) | |
$class | |
$alt | |
$width: Optionally define how wide this image should be at different breakpoints | |
--}} | |
<picture class="acf-image {{ $class ?? '' }}"> | |
<source srcset=" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- 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:heading {"level":1} --> | |
<h1>Heading One</h1> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
/* | |
|-------------------------------------------------------------------------- | |
| Register theme color palette | |
|-------------------------------------------------------------------------- | |
| | |
| Colors defined in this array will be registered with the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Remove EXIF data | |
* Plugin URI: https://gist.github.com/joshuafredrickson/cd5ab346992f533ecbe976d365fa36dd | |
* Version: 1.0.0 | |
* Description: Remove EXIF data from .jpg when uploaded. | |
* Author: Joshua Fredrickson | |
* Author URI: https://joshuafredrickson.com | |
* License: GNU General Public License v2 | |
* License URI: http://www.gnu.org/licenses/gpl-2.0.html |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Image sizes | |
* Finds the width for each column size based on a max container width (1600) and column count. | |
*/ | |
collect([3, 6, 9, 12])->map(function($column) { | |
return add_image_size($column . '/12', $column / 12 * 1600); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @2x image sizes | |
*/ | |
function make_it_retina($file, $width, $height, $crop = false) { | |
if ($width || $height) { | |
$resized_file = wp_get_image_editor($file); | |
if (!is_wp_error($resized_file)) { | |
$resized_file->resize($width * 2, $height * 2, $crop); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('plugins_loaded', function() { | |
$action = is_user_admin() ? 'user_admin_notices' : 'admin_notices'; | |
add_action($action, function () { | |
ob_start(); | |
}); | |
add_action('all_admin_notices', function () { | |
$log = strip_tags(trim(ob_get_clean())); |