WordPress – Remove query version string from static resources
Add to theme functions.php // remove query string from static files function remove_script_version_query_string( $src ) { if( strpos( $src, ‘?ver=’ ) ) $src = remove_query_arg( ‘ver’, $src ); return $src; } add_filter( ‘style_loader_src’, ‘remove_script_version_query_string’, 10, 2 ); add_filter( ‘script_loader_src’, ‘remove_script_version_query_string’, 10, 2 );
Read moreHow to remove Google Analytics By MonsterInsights tracking code
Remove tracking code in Google Page speed test if (!stripos($_SERVER[‘HTTP_USER_AGENT’], ‘Speed Insights’) === false){ remove_action( ‘wp_head’, ‘monsterinsights_tracking_script’, 6 ); } Remove Action remove_action( ‘wp_head’, ‘monsterinsights_tracking_script’, 6 );
Read morejQuery Scroll To Top
Dependencies(s) jQuery HTML ⇧ CSS #scroll-to-top:hover { background: #9e0a1c; } #scroll-to-top { width: 30px; position: fixed; bottom: 20px; right: 20px; background: #d6283d; color: white; text-shadow: 1px 1px 1px #010101; padding: 0px 5px 5px 5px; font-size: 30px; cursor: pointer; transition: .5s all; display: none; } JS jQuery(document).ready(function(){ var scrollToTop = $(‘#scroll-to-top’); var bottomCointainer = $(‘#main-footer’); var […]
Read moreAutomatic adjust element height based on the tallest element
It will loop all elements based on class and adjust the height based on the tallest element. HTML Code jQuery Code $(window).resize(function(){ initArticleBox(“.box”); }); $(window).load(function(){ initArticleBox(“.box”); }); function initArticleBox(selector){ var box = $(selector) box.height(“auto”); if ($(window).width() > 768){ var maxHeight = 0; var article = box.each(function(){ maxHeight = Math.max(maxHeight, jQuery(this).height()); }).height(maxHeight);; }else{ box.height(“auto”); } }
Read moreRemove emoji in WordPress source code
Add the following codes on your functions.php function disable_emojis() { remove_action( ‘wp_head’, ‘print_emoji_detection_script’, 7 ); remove_action( ‘admin_print_scripts’, ‘print_emoji_detection_script’ ); remove_action( ‘wp_print_styles’, ‘print_emoji_styles’ ); remove_action( ‘admin_print_styles’, ‘print_emoji_styles’ ); remove_filter( ‘the_content_feed’, ‘wp_staticize_emoji’ ); remove_filter( ‘comment_text_rss’, ‘wp_staticize_emoji’ ); remove_filter( ‘wp_mail’, ‘wp_staticize_emoji_for_email’ ); add_filter( ‘tiny_mce_plugins’, ‘disable_emojis_tinymce’ ); add_filter( ‘wp_resource_hints’, ‘disable_emojis_remove_dns_prefetch’, 10, 2 ); } add_action( ‘init’, ‘disable_emojis’); function disable_emojis_tinymce( […]
Read moreHow to rename Woocommerce order status?
Add the following code in your functions.php or custom plugin // rename processing to shipping function wc_rename_order_statuses( $statuses ) { foreach ( $statuses as $key => $status ) { $statuses[ $key ] = $status; if ( ‘wc-processing’ === $key ) { $statuses[‘wc-processing’] = _x( ‘Pending’, ‘Order status’, ‘woocommerce’ ); } if ( ‘wc-completed’ === $key […]
Read moreCreate dynamic page in WordPress using WP Rewrite
function custom_rewrite_basic() { add_rewrite_rule(‘^page/([^/]*)/’, ‘index.php?parameter=$matches[1]’, ‘top’); } add_action(‘init’, ‘custom_rewrite_basic’); function prefix_register_query_var( $vars ) { $vars[] = ‘parameter’; return $vars; } add_filter( ‘query_vars’, ‘prefix_register_query_var’ ); function prefix_url_rewrite_templates() { if ( get_query_var( ‘parameter’ )) { $GLOBALS[‘value’] = ‘value’; add_filter( ‘template_include’, function() { return get_template_directory() . ‘/page-templates/your-custom-template.php’; }); } } add_action( ‘template_redirect’, ‘prefix_url_rewrite_templates’ ); If there are any […]
Read more