$langs = trp_custom_language_switcher(); if ( get_locale() == ‘it_IT’) { $opposite = ‘en_US’; } else { $opposite = ‘it_IT’; } echo sprintf( ‘%s‘, $langs[$opposite][‘current_page_url’], $langs[$opposite][‘short_language_name’] );Continue reading
// Add duplicate button to post/page list of actions. add_filter( ‘post_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); add_filter( ‘page_row_actions’, ‘wpcode_snippet_duplicate_post_link’, 10, 2 ); // Let’s make sure the function doesn’t already exist. if ( ! function_exists( ‘wpcode_snippet_duplicate_post_link’ ) ) { /** *…Continue reading
add_filter( ‘block_editor_settings_all’, function ( $settings, $context ) { // The default image size when added in the block editor. $settings[‘imageDefaultSize’] = ‘full’; return $settings; }, 10, 2 );Continue reading
add_filter( ‘block_editor_settings_all’, function ( $settings ) { if ( ! isset( $settings[‘blockInspectorTabs’] ) ) { $settings[‘blockInspectorTabs’] = array(); } $settings[‘blockInspectorTabs’] = array_merge( $settings[ ‘blockInspectorTabs’ ], array( ‘default’ => false, // Disables for all blocks. ), ); return $settings; } );Continue reading
add_filter( ‘block_editor_settings_all’, function( $settings, $context ) { $settings[‘enableOpenverseMediaCategory’] = false; return $settings; }, 10, 2 );Continue reading
add_action( ‘current_screen’, function () { $screen = get_current_screen(); // Add other custom post types here as needed. if ( in_array( $screen->id, array( ‘post’, ‘page’ ) ) ) { remove_theme_support( ‘block-templates’ ); } } );Continue reading
// Add a new setting in wp-admin > Settings > General add_action( ‘admin_init’, function() { register_setting( ‘general’, ‘custom_heartbeat_interval’, ‘intval’ ); add_settings_field( ‘custom_heartbeat_interval’, ‘Heartbeat Interval’, function() { $interval = get_option( ‘custom_heartbeat_interval’, 120 ); echo “ seconds”; }, ‘general’ ); }); add_filter(…Continue reading
add_filter( ‘aioseo_woocommerce_breadcrumb_hide_shop’, ‘__return_true’ );Continue reading
/** * Do not store the cached IP address in a hidden field * * @link https://wpforms.com/developers/how-to-store-the-non-cached-ip-address-into-a-hidden-field/ */ function wpf_hidden_ip_avoid_cache( $fields, $entry, $form_data ){ // Only run on the form with ID 727 if( $form_data[ ‘id’ ] == 727 )…Continue reading