Skip to content

Instantly share code, notes, and snippets.

@irishquinn
Created December 15, 2018 01:16
Show Gist options
  • Save irishquinn/d1e410e3e16dfbe17f31d69ccf3c697a to your computer and use it in GitHub Desktop.
Save irishquinn/d1e410e3e16dfbe17f31d69ccf3c697a to your computer and use it in GitHub Desktop.
avada-functions.php performance improvements - remove portfolio and faq cpt
<?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