This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* カスタムフィールドを検索対象に含めます。(「-キーワード」のようなNOT検索にも対応します) | |
*/ | |
function posts_search_custom_fields( $orig_search, $query ) { | |
if ( $query->is_search() && $query->is_main_query() && ! is_admin() ) { | |
// 4.4のWP_Query::parse_search()の処理を流用しています。(検索語の分割処理などはすでにquery_vars上にセット済のため省きます) | |
global $wpdb; | |
$q = $query->query_vars; | |
$n = ! empty( $q['exact'] ) ? '' : '%'; | |
$searchand = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AddHandler php7.1-script .php | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTPS} off | |
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] | |
</IfModule> | |
<IfModule mod_rewrite.c> | |
RewriteEngine On |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.searchform { | |
margin: 34px 10px 40px 10px; | |
} | |
.searchform { | |
overflow: hidden; | |
clear: both; | |
position: relative; | |
width: 100%; | |
height: 48px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/////////////////////////////////////// | |
// 投稿本文中ウィジェットの追加 | |
/////////////////////////////////////// | |
register_sidebars(1, | |
array( | |
'name'=>'投稿本文中', | |
'id' => 'widget-in-article', | |
'description' => '投稿本文中に表示されるウィジェット。文中最初のH2タグの手前に表示されます。', | |
'before_widget' => '<div id="%1$s" class="widget-in-article %2$s">', | |
'after_widget' => '</div>', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_custom_post() { | |
register_post_type( | |
'infopage', | |
array( | |
'label' => 'お知らせ', | |
'public' => true, | |
'has_archive' => true, | |
'menu_position' => 5, | |
'supports' => array( | |
'title', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//functions.phpへ直書き | |
/* カスタム投稿タイプ */ | |
add_action( 'init', 'create_post_type' ); | |
function create_post_type() { | |
register_post_type( | |
'item', /* 投稿タイプのslug */ | |
array( | |
'labels' => array( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="jquery-1.11.0.min.js"></script> | |
<script type="text/javascript" src="jquery.rwdImageMaps.js"></script> | |
<script> | |
$(function(){ | |
$('img[usemap]').rwdImageMaps(); | |
}); | |
</script> | |
//※function()が2個になるなど複数記入したい場合は以下で |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>イメージマップをレスポンシブに対応させてみよう!</title> | |
<style> | |
html, | |
body { | |
margin: 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//headにタグを追加 | |
add_action( 'wp_head', 'add_meta_to_head' ); | |
function add_meta_to_head() { | |
echo 'ここにhead内に出力したい内容'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ルート直下にファイル名favicon.icoとして直置きでもOK | |
<link rel="icon" href="/img/favicon16.ico" type="image/x-icon"> | |
<link rel="icon" href="/img/favicon32.ico" type="image/x-icon"> | |
<link rel="icon" href="/img/favicon48.ico" type="image/x-icon"> | |
<link rel="icon" href="/img/favicon64.ico" type="image/x-icon"> | |
//ルート直下にファイル名favicon.icoとして直置きでもOK | |
<link rel="apple-touch-icon" href="img/apple-touch-icon57.png" sizes="57x57"> | |
<link rel="apple-touch-icon" href="img/apple-touch-icon60.png" sizes="60x60"> | |
<link rel="apple-touch-icon" href="img/apple-touch-icon72.png" sizes="72x72"> |