Skip to content

Instantly share code, notes, and snippets.

View anythinggraphic's full-sized avatar
☺️
Be the reason someone smiles today.

Kevin Donnigan anythinggraphic

☺️
Be the reason someone smiles today.
View GitHub Profile
@anythinggraphic
anythinggraphic / .htaccess
Last active May 10, 2017 23:23
Enable browser caching with .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 23:24
Remove ETag header. Use in conjunction with Cache-Control and Expires header.
# https://anythinggraphic.net/disable-emojis-in-wordpress-without-a-plugin
# BEGIN DISABLE ETAG HEADER
FileETag None
# END DISABLE ETAG HEADER
@anythinggraphic
anythinggraphic / functions.php
Last active August 31, 2017 21:34
Add custom Facebook Social Share images for Yoast SEO for Archive pages
<?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 / functions.php
Last active August 31, 2017 22:05
Add custom Twitter Social Share descriptions for Yoast SEO for Archive pages
<?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 August 31, 2017 22:05
Add custom Facebook Social Share descriptions for Yoast SEO for Archive pages
<?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' ) ) {
/*
Original link http://www.templatemonster.com/blog/style-checkboxes-radio-buttons-css adapted to Gravity Forms.
Uses Font Awesome. Make sure to wrap labels in <span> like so:
<script type="text/javascript">
jQuery(function($) {
$(".gfield_checkbox label, .gfield_radio label").wrapInner("<span></span>")
});
</script>
*/
/*
Original link http://www.templatemonster.com/blog/style-radioes-radio-buttons-css adapted to Gravity Forms.
Uses Font Awesome. Make sure to wrap labels in <span> like so:
<script type="text/javascript">
jQuery(function($) {
$(".gfield_checkbox label, .gfield_radio label").wrapInner("<span></span>")
});
</script>
*/
@anythinggraphic
anythinggraphic / loop.php
Last active October 18, 2017 13:55
Within your custom loop, get all taxonmies for a custom post type (CPT) and display each post within those taxonomies.
<?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 March 13, 2018 17:52
Gravity Forms: Change Stripe receipt description.
/* 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 / functions.php
Last active May 8, 2019 16:13
Move Post Title and Post Info from Entry Header to Entry Content
<?php
/* Move Post Title and Post Info from inside Entry Header to Entry Content on Posts page
----------------------------------------------------------------------------------------*/
add_action( 'genesis_before_entry', 'reposition_entry_header' );
function reposition_entry_header() {
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_do_post_title' );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );