Skip to content

Instantly share code, notes, and snippets.

@ofyalcin
Created December 26, 2016 20:57
Show Gist options
  • Save ofyalcin/1cd012de46a5ab9d5a43eb7def67ca64 to your computer and use it in GitHub Desktop.
Save ofyalcin/1cd012de46a5ab9d5a43eb7def67ca64 to your computer and use it in GitHub Desktop.
Wordpress javascript dosyalarını footera taşıma kodu. Detaylı bilgi için https://blogkurdu.net/javascript-dosyalarini-footera-tasimak-wordpress/ adresini ziyaret edin.
// Version parametresini kaldır kodu başlangıcı
function vc_remove_wp_ver_css_js( $src ) {
if ( strpos( $src, 'ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
}
add_filter( 'style_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
add_filter( 'script_loader_src', 'vc_remove_wp_ver_css_js', 9999 );
// Version parametresini kaldır kodu sonu
//Alternatif JS dosyalarını footera taşıma kodu başlangıcı
function footer_enqueue_scripts() {
remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'wp_enqueue_scripts', 1);
add_action('wp_footer', 'wp_print_scripts', 5);
add_action('wp_footer', 'wp_enqueue_scripts', 5);
add_action('wp_footer', 'wp_print_head_scripts', 5);
}
add_action('after_setup_theme', 'footer_enqueue_scripts');
// Kod sonu
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment