SSL化のメリット

常時SSLが推奨されている理由は、通信のはじめから最後までをすべて暗号化通信しないと、サイト利用ユーザーの個人情報やログイン情報を、悪意のある第三者の盗聴を防ぎ、改ざんやなりすましから守ることが困難なためです。 パフォーマンスを向上することが可能なのでちょっとSEOにいい。Googleの検索ランキングに影響します。

セキュリティ対策に導入をお勧めします。無料ですしね!


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

ダウンロードはこちらから


●JSファイル
$(function(){
	var device = navigator.userAgent;
	if((device.indexOf('iPhone') > 0 && device.indexOf('iPad') == -1) || device.indexOf('iPod') > 0 || device.indexOf('Android') > 0){
		$(".tel").wrap('');
	}
});


●HTMLファイル
<img class="tel" src="img/tel.png" alt="0120111111" />

class="tel" を付けてあげると、スマホの時だけ電話がかかる。

ただ、ただ、出力したい場合(基本タグ)


<?php single_month_title();>

これで、 9月2010 と表示される


●これを直したい場合、パーマリンクが「デフォルト」の場合
<div class="pagetitle">
	月別アーカイブ:<?php $thisyear=substr($m, 0, 4); $thismonth=substr($m, 4, 2); echo $thisyear.'年'.$thismonth.'月'; ?>
</div>

●パーマリンクを「デフォルト」以外、いじった場合
<div class="pagetitle">
	月別アーカイブ:<?php echo $year . '年' . $monthnum . '月'; ?>
</div>

投稿記事一覧で文字数を制限して表示


<dl>
    <dt><h1><?php the_title(); ?></h1></dt>
    <dd><p class="datat"><?php echo get_the_date(); ?></p>
	<?php echo mb_substr(get_the_excerpt(), 0, 200); ?>
        <a href="<?php the_permalink();?>">▼続きを読む</a>
    </dd>
</dl>

200の数字が文字制限数。ただしWP-tach プラグインでマルチバイトのプラグインを有効化しないと文字制限が働かないので注意。

すべてのページ(ワードプレス)からPタグを消す場合にはfunctions.phpを修正する。


remove_filter('the_content', 'wpautop');

特定のページだけ、Pタグを消す場合には、内容を出力する、the_content(); の前に記述すると消せる。


こっちの方が使い勝手は良好!
<?php remove_filter ('the_content', 'wpautop'); ?>
<?php the_content(); ?>

Thank you!  Word Press