Skip to content

Instantly share code, notes, and snippets.

View CapWebSolutions's full-sized avatar

Matt Ryan CapWebSolutions

View GitHub Profile
@CapWebSolutions
CapWebSolutions / don't-update-plugin.php
Created May 30, 2018 15:15
Do not check for plugin or theme update. Include in core functionality plugin.
/**
* Don't Update Plugin
*
* @since 1.0.0
*
* This prevents you being prompted to update if there's a public plugin
* with the same name.
*
* @author Mark Jaquith
* @link http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/
@CapWebSolutions
CapWebSolutions / first_date_footer.php
Created May 24, 2018 13:09
Function to automatically plug the date of first post into footer for copyright purposes.
@CapWebSolutions
CapWebSolutions / hash-upload-filename.php
Created May 22, 2018 14:00
Change filename on upload for jpg and png files.
<?php
/**
* Plugin Name: Hash Upload Filename
* Plugin URI: https://stackoverflow.com/questions/3259696/rename-files-during-upload-within-wordpress-backend
* Description: Rename uploaded jpg and png files as the hash of their original. Extension remains same.
* Author: Web Savvy Marketing
* Author URI: http://www.web-savvy-marketing.com
* Version: 1.0
*/
@CapWebSolutions
CapWebSolutions / gist:5cefe4b0d818ed07b4e1e08108dc801f
Created May 17, 2018 15:43
Fix issue with Gravity Forms Salesforce Web To Lead plugin from Katz
function hotfix_gforms_web_to_lead( $subdomain, $test ) {
// We will disregard the original subdomain value, which is legacy "www".
return ( $test ) ? 'test' : 'webto';
}
add_filter( 'gf_salesforce_request_subdomain', 'hotfix_gforms_web_to_lead', 10, 2 );
// ref: https://wordpress.org/support/topic/plugin-does-not-to-salesforce-web-to-lead-url-heres-how-to-fix-it/
@CapWebSolutions
CapWebSolutions / style.css
Created April 23, 2018 12:58
Excerpt of styles from day 22 of JavaScript30 by Wes Bos
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
min-height: 100vh;
margin: 0; /* Important! */
font-family: sans-serif;
@CapWebSolutions
CapWebSolutions / sticky-genesis-header.php
Created February 21, 2018 21:57
Sticky Genesis Header
/* Sticky header */
.site-header {
position: fixed;
width: 100%;
z-index: 1000;
}
/* this is optional and may not be needed in some situations */
nav.nav-primary {
@CapWebSolutions
CapWebSolutions / first_date_copyright.php
Created February 13, 2018 14:10
Set date of first post as start of copyright time frame in footer.
@CapWebSolutions
CapWebSolutions / gist:65d429a8d4479d9c4e11e7105633277c
Created February 8, 2018 17:24
Git Log command to show php files included in commits since a specified date
# Execute at the commadn line within your project.
> git log --since 2018-02-01 --pretty="short" --name-only | grep php
@CapWebSolutions
CapWebSolutions / add-read-more-button.php
Created February 7, 2018 23:11
Add Read More button to blog page and archives
// Add Read More button to blog page and archives
add_filter( 'excerpt_more', 'prefix_add_excerpt_more' );
add_filter( 'get_the_content_more_link', 'prefix_add_excerpt_more' );
add_filter( 'the_content_more_link', 'prefix_add_excerpt_more' );
function prefix_add_excerpt_more( $more ) {
return '<span class="more-link"><a href="' . get_permalink() . '" rel="dofollow">' . __( 'Read More', 'prefix' ) . '</a></span>';
}
@CapWebSolutions
CapWebSolutions / manually-insert-cat-title,php
Created February 7, 2018 23:09
Manually insert Category Title to Blog Categories
//* Manually insert Cat Title to Blog Categories
remove_action( 'genesis_before_loop', 'genesis_do_taxonomy_title_description', 15 );
add_action('genesis_before_loop','prefix_cat_title', 16);
function prefix_cat_title () {
if( is_category() || is_tag() || is_tax() ) {
global $wp_query;
$term = is_tax() ? get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ) : $wp_query->get_queried_object();
$intro_text = apply_filters( 'genesis_term_intro_text_output', $term->meta['intro_text'] );
printf('<div class="archive-description"><h1 class="archive-title">%1$s</h1>%2$s</div>', single_cat_title( '', false ), $intro_text);
}