Skip to content

Instantly share code, notes, and snippets.

Kevin Donnigan anythinggraphic

Block or report user

Report or block anythinggraphic

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
@anythinggraphic
anythinggraphic / functions.php
Last active Mar 13, 2018
Gravity Forms: Change Stripe receipt description.
View functions.php
/* Change the description of Gravity Forms/Stripe Form Stripe Receipt (product)
----------------------------------------------------------------------------------------*/
add_filter( 'gform_stripe_charge_description', 'ag_custom_product_receipt', 10, 4 );
function ag_custom_product_receipt( $description, $strings, $entry, $submission_data ) {
$payment_amount = rgar( $submission_data, 'payment_amount' );
$description = "Payment Amount: " . $payment_amount;
GFCommon::log_debug( __METHOD__ . "(): Custom description for the product: " . $description );
@anythinggraphic
anythinggraphic / jquery.js
Last active Nov 13, 2017
Script to move elements around based on window width
View jquery.js
// @link https://mattrad.uk/move-elements-around-using-jquery/
// Script to move elements around based on window width
jQuery(function($) {
// Store the references outside the event handler:
var $window = $(window);
var $pane1 = $('#search-dropdown');
var $pane2 = $('.social-icons');
function checkWidth() {
@anythinggraphic
anythinggraphic / loop.php
Last active Oct 18, 2017
Within your custom loop, get all taxonmies for a custom post type (CPT) and display each post within those taxonomies.
View loop.php
<?php
/* @link TBA
/* Within your custom loop, get all taxonomies for a custom post type (CPT) and display each post within those taxonomies
----------------------------------------------------------------------------------------*/
$post_type = 'your_cpt_name';
// Get all of the taxonomies for this post type
$taxonomies = get_object_taxonomies((object) array( 'post_type' => $post_type )); ?>
@anythinggraphic
anythinggraphic / functions.php
Last active Aug 31, 2017
Add custom Twitter Social Share descriptions for Yoast SEO for Archive pages
View functions.php
<?php
/* @link https://anythinggraphic.net/yoast-seo-add-custom-social-share-images-for-archive-category-pages-in-wordpress
/* Add custom Twitter Social Share descriptions for Yoast SEO for Archive pages
----------------------------------------------------------------------------------------*/
add_filter( 'wpseo_metadesc', 'ag_yoast_seo_tw_share_descriptions', 10, 1 );
function ag_yoast_seo_tw_share_descriptions( $desc ) {
if( is_post_type_archive( 'portfolio' ) ) {
$desc = 'Design and development projects by Anything Graphic.';
}
if( is_category( 'categoryname' ) ) {
@anythinggraphic
anythinggraphic / functions.php
Last active Aug 31, 2017
Add custom Facebook Social Share descriptions for Yoast SEO for Archive pages
View functions.php
<?php
/* @link https://anythinggraphic.net/yoast-seo-add-custom-social-share-images-for-archive-category-pages-in-wordpress
/* Add custom Facebook Social Share descriptions for Yoast SEO for Archive pages
----------------------------------------------------------------------------------------*/
add_filter( 'wpseo_opengraph_desc', 'ag_yoast_seo_fb_share_descriptions' );
function ag_yoast_seo_fb_share_descriptions( $desc ) {
if( is_post_type_archive( 'posttypename' ) ) {
$desc = 'Design and development projects by Anything Graphic.';
}
if( is_category( 'categoryname' ) ) {
View functions.php
<?php
/* @link https://anythinggraphic.net/yoast-seo-add-custom-social-share-images-for-archive-category-pages-in-wordpress
/* Add custom Twitter Social Share images for Yoast SEO for Archive pages
----------------------------------------------------------------------------------------*/
add_filter( 'wpseo_twitter_image', 'ag_yoast_seo_tw_share_images', 10, 1 );
function ag_yoast_seo_tw_share_images( $img ) {
if( is_post_type_archive( 'archivename') ) {
$img = get_stylesheet_directory_uri().'/images/your-image-file.jpg';
}
iif( is_category( 'categoryname') ) {{
@anythinggraphic
anythinggraphic / functions.php
Last active Aug 31, 2017
Add custom Facebook Social Share images for Yoast SEO for Archive pages
View functions.php
<?php
/* @link https://anythinggraphic.net/yoast-seo-add-custom-social-share-images-for-archive-category-pages-in-wordpress
/* Add custom Facebook Social Share images for Yoast SEO for Archive pages
----------------------------------------------------------------------------------------*/
add_filter( 'wpseo_opengraph_image', 'ag_yoast_seo_fb_share_images', 10, 1 );
function ag_yoast_seo_fb_share_images( $img ) {
if( is_post_type_archive( 'archivename') ) {
$img = get_stylesheet_directory_uri().'/images/your-image-file.jpg';
}
if( is_category( 'categoryname') ) {
@anythinggraphic
anythinggraphic / .htaccess
Last active May 10, 2017
Remove ETag header. Use in conjunction with Cache-Control and Expires header.
View .htaccess
# https://anythinggraphic.net/disable-emojis-in-wordpress-without-a-plugin
# BEGIN DISABLE ETAG HEADER
FileETag None
# END DISABLE ETAG HEADER
@anythinggraphic
anythinggraphic / .htaccess
Last active May 10, 2017
Enable browser caching with .htaccess.
View .htaccess
# https://anythinggraphic.net/disable-emojis-in-wordpress-without-a-plugin
## BEGIN BROWSER CACHING (EXPIRES CACHING)
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
@anythinggraphic
anythinggraphic / .htaccess
Last active May 10, 2017
GZip compression in .htaccess file.
View .htaccess
# https://anythinggraphic.net/disable-emojis-in-wordpress-without-a-plugin
# BEGIN GZIP COMPRESSION
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
You can’t perform that action at this time.