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 / 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' ) ) {
<?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';
}
if( is_category( 'categoryname') ) {{
@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 / .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 / .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:23
GZip compression in .htaccess file.
# 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
@anythinggraphic
anythinggraphic / functions.php
Created April 15, 2017 22:00
Paste As Text by default in the WordPress editor.
<?php
/* @link https://anythinggraphic.net/paste-as-text-by-default-in-wordpress
/* Use Paste As Text by default in the editor
----------------------------------------------------------------------------------------*/
add_filter('tiny_mce_before_init', 'ag_tinymce_paste_as_text');
function ag_tinymce_paste_as_text( $init ) {
$init['paste_as_text'] = true;
return $init;
}
@anythinggraphic
anythinggraphic / functions.php
Last active September 22, 2022 22:03
Give each Gravity Forms entry a unique ID
<?php
/* Put a unique ID on Gravity Form (single form ID) entries.
----------------------------------------------------------------------------------------*/
add_filter("gform_field_value_uuid", "get_unique");
function get_unique(){
$prefix = "SLP2017-"; // update the prefix here
do {
@anythinggraphic
anythinggraphic / functions.php
Last active January 29, 2017 03:43
Change the link on the entry-title for each post to a custom one on Archives page
<?php
/* @link https://anythinggraphic.net/change-entry-title-post-links-archives-genesis/
/* Change the link on the entry-title for each post to a custom one on Archives page
----------------------------------------------------------------------------------------*/
add_filter( 'genesis_post_title_output', 'ag_custom_post_title_link' );
function ag_custom_post_title_link( $title ) {
if( is_archive() ) {
$post_title = get_the_title( get_the_ID() );
$title = '<h2 class="entry-title" itemprop="headline"><a href="' . get_field('link') . '" target="new">' . $post_title . '</a></h2>';