q2w3-fixed-widget | contact-form-7 | jquery-masonry | twentythirteen-script | wp-embed | metaslider-flex-slider | metaslider-easing |
月別アーカイブ: 2017年12月
printer spooler at XP
- ファイル名を指定して実行
- services.msc
- printer spooler ->stop
- 再開
Critical Path CSS Generator
https://jonassebastianohlsson.com/criticalpathcssgenerator/
1.
wp JS defer
/*
* Getting script tags
* Thanks http://wordpress.stackexchange.com/questions/54064/how-do-i-get-the-handle-for-all-enqueued-scripts
*/
add_action( 'wp_print_scripts', 'wsds_detect_enqueued_scripts' );
function wsds_detect_enqueued_scripts() {
global $wp_scripts;
foreach( $wp_scripts->queue as $handle ) :
echo $handle . ' | ';
endforeach;
}
admin-bar | contact-form-7 | maxbuttons-front | jquery | twentysixteen-html5 | twentysixteen-skip-link-focus-fix | twentysixteen-script |
add_filter( 'script_loader_tag', 'wsds_defer_scripts', 10, 3 );
function wsds_defer_scripts( $tag, $handle, $src ) {
// The handles of the enqueued scripts we want to defer
$defer_scripts = array(
'admin-bar',
'contact-form-7',
'maxbuttons-front',
' jquery',
'wpshout-js-cookie-demo',
'twentysixteen-html5',
'twentysixteen-skip-link-focus-fix',
'twentysixteen-script',
);
if ( in_array( $handle, $defer_scripts ) ) {
return '<script src="' . $src . '" defer="defer" type="text/javascript"></script>' . "\n";
}
return $tag;
}
Child theme enqueue function
In funcions.php of child theme:
function my_theme_enqueue_styles() {
$parent_style = ‘parent-style’; // This is ‘twentyfifteen-style’ for the Twenty Fifteen theme.
Replace ‘parent-style’ with actual parent theme; like ‘twentysixteen-style’.
Otherwise, css loading is doubled with strange( parent theme version?) version name.
Theme seen by mobile when switcher is activated
chips/jsstour: Theme: child2
switcher setting: smartphoneTheme: child
real mobile: child is seen at mobile; narrow browser on PC sees child2;
Setting is the same at japansightseeingtour.jp .
Speed up jss.chips.jp/jsstour
Restart all again using Autoptimize:
1. Undo manipulation relating JS as described in Speed up jsstour(1):
migrate tokyoguide-noriko to japansightseeing.chips.jp/norikoguide
1. Copy files. (using xp machine)tgn to jss.chips.jp/norikoguide
2.
SpeedUp jsstour.jp (1)
1.remove render blocking JS (tentative, not ideal)
1.1 Insert following extra script in header.php just above <?php wp_head(); ?> in both of child2 and child theme.
<script type=’text/javascript’ src=’http://japansightseeingtour.jp/wp-includes/js/jquery/jquery.js?ver=1.12.4′ async></script>
1.2.Insert the following in functions.php in both of child themes.
// Begin Custom Scripting to Move JavaScript from the Head to the Footer
function remove_head_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( ‘wp_enqueue_scripts’, ‘remove_head_scripts’ );
// END Custom Scripting to Move JavaScript
2. Activate “autoptimize”.