Skip to content

Instantly share code, notes, and snippets.

Brian Richards brichards

Block or report user

Report or block brichards

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@brichards
brichards / rewrites-1.php
Created Feb 28, 2016
In all of the below cases permalinks have been flushed. The endpoint works perfectly fine for all scenarios _except_ the home page.
View rewrites-1.php
Using only this, hiting ^/bpa/whatever/ serves blog archive instead of static front page.
<?php
/**
* Create url endpoint for BPA
*
* @since 1.0.0
*/
function cfpurl_rewrite_rules() {
View Chatpen.markdown

Chatpen

Multiuser chat built with React and Firebase. Note that this is on the Firebase free plan, so if more than 50 users are on it things may go south.

A Pen by Brad Daily on CodePen.

License.

View .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f [NC]
RewriteRule ^(.*\.(js|css|png|jpe?g|gif|ico)) http://example.com/$1 [NC,P,L]
</IfModule>
View no-translation.php
<?php
$url = esc_url( get_post_meta( $post->ID, '_project-url', true ) );
if ( ! empty( $url ) {
printf( '<p>%s</p>', $url );
}
?>
View kb-press.php
<?php
/**
* Output HTML markup for forum post list.
*
* @since 1.0.0
*
* @param integer $post_count Post count.
*/
function skbp_output_forum_posts_list( $post_count = 5 ) {
View pre-commit
#!/usr/bin/php
<?php
echo PHP_EOL;
echo 'Starting unit tests' . PHP_EOL;
exec( 'phpunit', $test_output, $returnCode );
if ( 0 !== $returnCode ) {
echo implode( PHP_EOL, $test_output );
echo PHP_EOL;
@brichards
brichards / functions.php
Created Jan 3, 2014
Make all WP oEmbedded videos responsive.
View functions.php
<?php
/**
* Wrap an embedded video with a container for simpler styling.
*
* @since 1.0.0
*
* @param string $output HTML Markup.
* @param string $url oEmbed URL.
View gist:7517250
=== Almost always running ===
Google Chrome (10 tabs average)
Vagrant (running VirtualBox)
SublimeText 2
iTerm2
Alfred
Dropbox
Skype
Tweetbot
Hipchat
View gist:7191030
<?php
/**
* Change "Featured Image" to "Achievement Image" throughout media modal.
*
* @since 1.3.0
*
* @param array $strings All strings passed to media modal.
* @param object $post Post object.
* @return array Potentially modified strings.
*/
View inline-file-header
<?php
/*
Pages
Short description
Since x.x.x
*/
/* Pages
* Short description
You can’t perform that action at this time.