Skip to content

Instantly share code, notes, and snippets.

View taricco's full-sized avatar

Tim in Seattle taricco

  • Seattle, WA
View GitHub Profile
/*** Add "Reading Time" to Posts
Display with dyanmic template tag {{fn.wsv_read_time_badge}} - https://snippetclub.com/dynamic-template-tags/
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/
function wsv_calc_read_time($post_id = 0) {
$post_id = $post_id ?: get_the_ID();
$wpm = (int) apply_filters('wsv_read_time_wpm', 225);
if ($wpm < 100) $wpm = 100;
$content = get_post_field('post_content', $post_id);
/*** Add Tags to CPTs
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/
// 1) Make these CPTs support post_tag
add_action( 'init', function () {
$post_types = [ 'reports', 'webinars', 'ebooks', 'guidebooks', 'solutions' ];
foreach ( $post_types as $pt ) {
register_taxonomy_for_object_type( 'post_tag', $pt );
}
}, 11 ); // run after CPTs are registered
https://wordpress.org/plugins/gravity-forms-email-blacklist/
Settings:
- Please use a business email address. Personal email domains (e.g., Gmail, Hotmail) are not accepted.
- 027168.com, 0815.su, 0sg.net, 10mail.org, 10minutemail.co.za, 11mail.com, 123.com, 123box.net, 123india.com, 123mail.cl, 123mail.org, 123qwe.co.uk, 126.com, 139.com, 150mail.com, 150ml.com, 15meg4free.com, 163.com, 16mail.com, 188.com, 189.cn, 1ce.us, 1chuan.com, 1coolplace.com, 1freeemail.com, 1funplace.com, 1internetdrive.com, 1mail.ml, 1mail.net, 1me.net, 1mum.com, 1musicrow.com, 1netdrive.com, 1nsyncfan.com, 1pad.de, 1under.com, 1webave.com, 1webhighway.com, 1zhuan.com, 2-mail.com, 20email.eu, 20mail.in, 20mail.it, 212.com, 21cn.com, 24horas.com, 2911.net, 2980.com, 2bmail.co.uk, 2d2i.com, 2die4.com, 2trom.com, 3000.it, 30minutesmail.com, 3126.com, 321media.com, 33mail.com, 37.com, 3ammagazine.com, 3dmail.com, 3email.com, 3g.ua, 3mail.ga, 3xl.net, 444.net, 4email.com, 4email.net, 4mg.com, 4newyork.com, 4warding.net, 4warding.org,
//This code comes from https://snippetnest.com/snippet/remove-clutter-from-block-editor/
// Exclude specific blocks and namespaces
// Reorder block categories in the block inserter
// Exclude specific blocks and namespaces by User Role
// Exclude specific blocks and namespaces by Post Type
// Exclude specific blocks and namespaces
add_filter('allowed_block_types_all', function($allowed_blocks, $editor_context) {
/**
* Register custom dynamic tags for GenerateBlocks from WooCommerce.
*/
add_action('init', 'register_woocommerce_dynamic_tags');
function register_woocommerce_dynamic_tags() {
if (class_exists('GenerateBlocks_Register_Dynamic_Tag')) {
// 1. Label Sale
new GenerateBlocks_Register_Dynamic_Tag(
/*** IMPORTANT: The plugin Admin and Site Enhancements (ASE) hides the notices. ***/
/*** Posts Alert Message
Notes: notice-error #d63638, notice-warning #dba617, notice-success #00a32a, notice-info #72aee6.
ChatGPT Generated
–––––––––––––––––––––––––––––––––––––––––––––––––– ***/
function posts_admin_notice() {
global $pagenow;
// Add a GeneratePress Element at the TOP or BOTTOM of the Primary menu.
// generate_top_of_primary_menu
// generate_bottom_of_primary_menu
add_shortcode('top_of_primary_menu_hook', function($atts) {
ob_start();
$atts = shortcode_atts(array(
'hook_name' => 'top of menu'
), $atts, 'top_of_primary_menu_hook');
do_action($atts['hook_name']);
return ob_get_clean();
//Custom Hook is: generate_bottom_of_primary_menu
add_shortcode('bottom_of_primary_menu_hook', function($atts){
ob_start();
$atts = shortcode_atts( array(
'hook_name' => 'bottom of menu'
), $atts, 'bottom_of_primary_menu_hook' );
do_action($atts['hook_name']);
return ob_get_clean();
});
//Custom Hook is: generate_top_of_primary_menu
add_shortcode('top_of_primary_menu_hook', function($atts){
ob_start();
$atts = shortcode_atts( array(
'hook_name' => 'top of menu'
), $atts, 'top_of_primary_menu_hook' );
do_action($atts['hook_name']);
return ob_get_clean();
});