Skip to content

Instantly share code, notes, and snippets.

View brianleejackson's full-sized avatar
✍️
Writing

Brian Jackson brianleejackson

✍️
Writing
View GitHub Profile
@brianleejackson
brianleejackson / 0_reuse_code.js
Last active August 29, 2015 14:13
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
@brianleejackson
brianleejackson / rss-feed-featured-image
Created April 23, 2015 02:57
Adding a featured image to WordPress RSS Feed
// register custom post type to work with
function lc_create_post_type() {
// set up labels
$labels = array (
'name' => 'Events',
'singular_name' => 'Event',
'add_new' => 'Add New Event',
'add_new_item' => 'Add New Event',
'edit_item' => 'Edit Event',
'new_item' => 'New Event',
@brianleejackson
brianleejackson / header-meta-tags.php
Last active July 3, 2017 06:42
header-meta-tags.php (lines 86-92)
// Echo it if we're using the Admin Head Hook
echo '<style>@font-face {font-family: "sw-icon-font";src:url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.eot");src:url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.eot?#iefix") format("embedded-opentype"),url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.woff") format("woff"),
url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.ttf") format("truetype"),url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.svg?#1445203416") format("svg");font-weight: normal;font-style: normal;}</style>';
else :
// Add it to our array if we're using the froSntend Head Hook
$info['html_output'] .= PHP_EOL . '<style>@font-face {font-family: "sw-icon-font";src:url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.eot");src:url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.eot?#iefix") format("embedded-opentype"),url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.woff") format("woff"), url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.ttf") format("truetype"),url("' . SWP_PLUGIN_URL . '/fonts/sw-icon-font.svg?#1
@brianleejackson
brianleejackson / gp-read-more.php
Last active July 13, 2022 21:34
GeneratePress read more link on blog post archive, as seen on https://woorkup.com
add_filter( 'wp_trim_excerpt', 'tu_excerpt_metabox_more' );
function tu_excerpt_metabox_more( $excerpt ) {
$output = $excerpt;
$settings = wp_parse_args(
get_option( 'generate_blog_settings', array() ),
generate_blog_get_defaults()
);
if ( has_excerpt() ) {
$output = sprintf('%1$s <br /><a class="read-more" href="%2$s">%3$s →</a>',
@brianleejackson
brianleejackson / gp-yoast-seo-cdn.php
Last active March 14, 2018 02:00
gp-yoast-seo-cdn
function wpseo_cdn_filter( $uri ) {
return str_replace( 'https://domain.com', 'https://cdn.domain.com', $uri );
}
add_filter( 'wpseo_xml_sitemap_img_src', 'wpseo_cdn_filter' );
@brianleejackson
brianleejackson / gp-disable-google-fonts.php
Last active September 4, 2017 23:17
gp-disable-google-fonts
add_action( 'wp_enqueue_scripts','tu_remove_google_fonts', 10 );
function tu_remove_google_fonts() {
wp_dequeue_style( 'generate-fonts' );
}
@brianleejackson
brianleejackson / gp-updated-date.php
Last active January 9, 2023 14:05
Display the date a post was updated in the GeneratePress 3.0 theme as seen on https://woorkup.com
add_filter( 'generate_post_date_output', function( $output, $time_string ) {
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">Published on %2$s</time>';
if ( get_the_date() !== get_the_modified_date() ) {
$time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">Updated on %4$s</time>';
}
$time_string = sprintf( $time_string,
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
@brianleejackson
brianleejackson / gp-svg-logo.css
Created September 5, 2017 04:53
gp-svg-logo
.site-logo img {
width: 155px;
}