Created
December 15, 2018 01:16
-
-
Save irishquinn/d1e410e3e16dfbe17f31d69ccf3c697a to your computer and use it in GitHub Desktop.
avada-functions.php performance improvements - remove portfolio and faq cpt
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 to avada child theme functions.php | |
//async all js | |
function add_async_attribute($tag, $handle) | |
{ | |
if ('my-js-handle' !== $handle) | |
return $tag; | |
return str_replace(' src', ' async="async" src', $tag); | |
} | |
add_filter('script_loader_tag', 'add_async_attribute', 10, 2); | |
add_filter('tg_wp_query_args', 'my_query_args', 10, 2); | |
// remove query string from static resources to speed up site | |
function _remove_script_version($src) | |
{ | |
$parts = explode('?ver', $src); | |
return $parts[0]; | |
} | |
add_filter('script_loader_src', '_remove_script_version', 15, 1); | |
add_filter('style_loader_src', '_remove_script_version', 15, 1); | |
// remove wp emoji from site | |
remove_action('wp_head', 'print_emoji_detection_script', 7); | |
remove_action('wp_print_styles', 'print_emoji_styles'); | |
// REMOVE FAQ AND PORTFOLIO FROM AVADA INSTALL | |
function cbm_remove_menus() | |
{ | |
remove_menu_page('edit.php?post_type=avada_portfolio'); //Portfolio | |
remove_menu_page('edit.php?post_type=avada_faq'); //FAQs | |
} | |
add_action('admin_menu', 'cbm_remove_menus'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment