This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//License is public domain, use to your hearts content. I take no ownership or responsibility | |
use Barn2\Plugin\EDD_VAT\VAT_Check_Result; | |
add_filter( 'edd_vat_number_check', function ($result, $vat_number, $country_code ) { | |
if($result->error === VAT_Check_Result::INVALID_INPUT && $country_code==='GB') { | |
if(strlen($vat_number)!==9 || !filter_var($vat_number, FILTER_VALIDATE_INT)) { | |
return $result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* [Update] This Gist has been integrated into the WordPress Plugin "I don't like Spam!" which supports more WordPress Contact Forms: | |
* https://wordpress.org/plugins/i-dont-like-spam | |
* | |
* Ninja Forms: Server side spam protection making use of the WordPress Comment Blocklist | |
* https://developer.ninjaforms.com/codex/custom-server-side-validation | |
* | |
* Enter your blocklist here: Settings > Discussion > Comment Blocklist | |
* https://developer.wordpress.org/reference/functions/wp_blacklist_check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function (context, trackingId, options) { | |
const history = context.history; | |
const doc = document; | |
const nav = navigator || {}; | |
const storage = localStorage; | |
const encode = encodeURIComponent; | |
const pushState = history.pushState; | |
const typeException = 'exception'; | |
const generateId = () => Math.random().toString(36); | |
const getId = () => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_enqueue_scripts','tu_remove_google_fonts', 10 ); | |
function tu_remove_google_fonts() { | |
wp_dequeue_style( 'generate-fonts' ); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'generate_post_date_output', 'tu_show_modified_date' ); | |
function tu_show_modified_date() { | |
$time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>'; | |
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { | |
$time_string = 'Updated on: <time class="updated" datetime="%3$s" itemprop="dateModified">%4$s</time>'; | |
} | |
$time_string = sprintf( $time_string, | |
esc_attr( get_the_date( 'c' ) ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'the_content', 'featured_image_in_feed' ); | |
function featured_image_in_feed( $content ) { | |
global $post; | |
if( is_feed() ) { | |
if ( has_post_thumbnail( $post->ID ) ){ | |
$output = get_the_post_thumbnail( $post->ID, 'medium', array( 'style' => 'float:right; margin:0 0 10px 10px;' ) ); | |
$content = $output . $content; | |
} | |
} |