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 | |
$arr = [ | |
'apples' => [ | |
'red' => [ | |
'gala', | |
'mcintosh', | |
], | |
'green' => [ | |
'granny_smith', |
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 | |
function flatten_blocks( array $blocks ) { | |
reset( $blocks ); | |
$out = []; | |
while ( $block = array_shift( $blocks ) ) { | |
$out[] = $block; |
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
const useEffectOnceOnDemand = (effect) => { | |
const [count, setCount] = useState(0); | |
useEffect(() => { | |
if (1 === count) { | |
effect(); | |
} | |
}); | |
return () => setCount((prev) => Math.min(2, prev + 1)); |
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:cover {"url":"https://cldup.com/Fz-ASbo2s3.jpg","className":"alignwide"} --> | |
<div class="wp-block-cover has-background-dim alignwide" style="background-image:url(https://cldup.com/Fz-ASbo2s3.jpg)"><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} --> | |
<p class="has-text-align-center has-large-font-size">Of Mountains & Printing Presses</p> | |
<!-- /wp:paragraph --></div></div> | |
<!-- /wp:cover --> | |
<!-- wp:paragraph --> | |
<p>The goal of this new editor is to make adding rich content to WordPress simple and enjoyable. This whole post is composed of <em>pieces of content</em>—somewhat similar to LEGO bricks—that you can move around and interact with. Move your cursor around and you’ll notice the different blocks light up with outlines and arrows. Press the arrows to reposition blocks quickly, without fearing about losing things in the process of copying and pasting.</p> | |
<!-- /wp:paragraph --> |
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 | |
/** | |
* Print syndication debugging information about a post. | |
* | |
* ## OPTIONS | |
* | |
* <id> | |
* : Post ID. | |
* |
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 | |
add_action( 'send_headers', function ( $wp ) { | |
if ( ! empty( $wp->query_vars['feed'] ) ) { | |
header( 'Cache-Control: no-cache, no-store, must-revalidate' ); | |
} | |
}, 100 ); | |
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: Members | |
*/ | |
function member_init() { | |
register_post_type( 'member', array( | |
'labels' => array( | |
'name' => __( 'Members', 'foobar' ), | |
'singular_name' => __( 'Member', 'foobar' ), |
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
#!/bin/bash | |
# Usage: ./distribute_user.sh [username] [role] | |
ARGS="$@" | |
echo "Adding user $1 as $2 to all sites" | |
SITES=$(wp site list --field=url --format=csv) | |
for site in $SITES | |
do |
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
sudo ln -s /usr/local/Cellar/php54/5.4.11/lib/php/texy/src/texy.php /usr/local/Cellar/php54/5.4.11/lib/php |
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( 'wp_head', 'my_bwp_recent_comments_template' ); | |
function my_bwp_recent_comments_template() { | |
global $bwp_rc; | |
$bwp_rc->options['template_comment'] = '<p>My template here</p>'; | |
} |