Skip to content

Instantly share code, notes, and snippets.

Avatar

Brian Richards brichards

View GitHub Profile
@brichards
brichards / customizer.css
Created Feb 28, 2020
Custom CSS for WPBlockTalk.com
View customizer.css
h3:before {
display: inline-block;
margin-left: -45px;
padding-right: 45px;
width: 30px;
height: 30px;
background: url('https://cldup.com/_NaTHCOsGQ.svg') no-repeat;
content: '';
}
@brichards
brichards / comments-page.php
Created Aug 7, 2019
Plugin to make WordPress comments available at <post_url>/comments/.
View comments-page.php
<?php
/**
* Plugin Name: Comments Page
* Plugin URI: https://WPSessions.com
* Description: Makes comments for a post accessible at <post_url>/comments/.
* Author: Brian Richards
* Author URI: https://rzen.net
* Text Domain: comments-page
* Domain Path: /languages
* Version: 0.1.0
@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