「WP related」カテゴリーアーカイブ

ssl lolipop

セキュリティ→独自ssl証明書導入→対象ドメインチェックボックス・チェック→導入クリック:設定中:::10分?::設定有効ドメインに該ドメインが表示

該フォルダにmurasecret設置:search&replace:  http://jsst4.japantourguide.net     with  https://jsst4.japantourguide.net:::::::The table “wptest_maxbuttons_collections_trans” has no primary key. Changes will have to be made manually.

in WP dashboard: setting:General isO.K.    Reading: check  discourage search engine :   Save

At this point, all pages seem all right for https.

in .htaccess, add the following:

# TN – END EXPIRES CACHING #
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>

 

Rewrite rule in .htaccess for subdomain

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

While if wp reside just in a directory:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /jsst3/
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /jsst3/index.php [L]
</IfModule>

# END WordPress

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.

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”.

 

wp_head() related

wp-includes/default-filters.php

<script type=”text/javascript” src=”http://japansightseeing.chips.jp/jsstour/wp-includes/js/jquery/jquery.js?ver=1.12.4″></script>

/*
<?php
function my_delete_local_jquery() {
wp_deregister_script(‘jquery’);
}
add_action( ‘wp_enqueue_scripts’, ‘my_delete_local_jquery’ );
?>
*/

// 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

<script type=’text/javascript’ src=’http://japansightseeing.chips.jp/jsstour/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.4.1′></script>

<script type=’text/javascript’ src=’http://japansightseeing.chips.jp/jsstour/wp-includes/js/jquery/jquery.js?ver=1.12.4′></script>