Skip to content

Instantly share code, notes, and snippets.

@hitsujixgit
hitsujixgit / functions.php
Created June 28, 2014 10:47
Retinaディスプレイに対応する - 実践的テーマを作成する #5
<?php
// ・・・途中まで省略
// 倍解像度画像サイズを追加する
add_image_size('thumbnail_for_2x', 300, 300);
add_image_size('medium_for_2x', 600, 600);
add_image_size('large_for_2x', 1200, 1200);
// メディアライブラリに倍解像度画像サイズを登録する
add_filter( 'image_size_names_choose', 'my_custom_image_sizes' );
@hitsujixgit
hitsujixgit / index.html
Created June 28, 2014 05:16
Show Yokohama city map divided into administrative divisions with its each division's name in Japanese.
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://d3js.org/topojson.v0.min.js"></script>
<style type="text/css">
h1 {
font-size: 16px;
}
@hitsujixgit
hitsujixgit / functions.php
Created June 19, 2014 13:43
カスタムヘッダーを設置する - index.phpをカスタマイズする#8
<?php
// カスタムヘッダー画像を設置する
$custom_header_defaults = array(
'default-image' => get_bloginfo('template_url').'/img/wordpress-logo-hoz-rgb_small.png',
'width' => 220,
'height' => 50,
'header-text' => false, //ヘッダー画像上にテキストをかぶせる
);
add_theme_support( 'custom-header', $custom_header_defaults );
@hitsujixgit
hitsujixgit / script.js
Created June 19, 2014 11:44
Read 2 json files.
// file読み込み制御用
var readTopofileDone = false;
var readAttrfileDone = false;
// filedata格納変数
var topodata;
var attrdata;
var map_width = 500;
var map_height = 650;
var svg;
@hitsujixgit
hitsujixgit / style.css
Created June 19, 2014 11:17
カスタムメニューを設置する - index.phpをカスタマイズする#8
ul#main-nav {
clear: both;
margin: 0;
padding: 0;
height: 35px;
background-color: #777;
border-radius: 3px;
overflow: hidden;
}
ul#main-nav li {
@hitsujixgit
hitsujixgit / source.html
Created June 19, 2014 11:15
カスタムメニューを設置する - index.phpをカスタマイズする#8
<nav>
<ul id="main-nav">
<li id="menu-item-30" class="menu-item ..."><a href="http://localtest.net">ホーム</a></li>
<li id="menu-item-28" class="menu-item ..."><a href="http://localtest.net/about/">このサイトについて</a></li>
<li id="menu-item-31" class="menu-item ..."><a href="http://localtest.net/category/diary/">日記</a></li>
</ul>
</nav>
@hitsujixgit
hitsujixgit / header.php
Created June 19, 2014 11:14
カスタムメニューを設置する - index.phpをカスタマイズする#8
<nav>
<?php wp_nav_menu( array(
'theme_location'=>'mainmenu',
'container' =>'',
'menu_class' =>'',
'items_wrap' =>'<ul id="main-nav">%3$s</ul>'));
?>
</nav>
@hitsujixgit
hitsujixgit / functions.php
Created June 19, 2014 11:09
カテゴリIDを階層順に並べた配列をつくる
<?php
function get_categories_tree() {
$post_categories = get_the_category();
$cat_trees = array();
$cat_counts = array();
$cat_depth_max = 10;
foreach ( $post_categories as $post_category ) {
$depth = 0;
@hitsujixgit
hitsujixgit / comments.php
Created June 19, 2014 10:41
コメントフォームをカスタマイズする - index.phpをカスタマイズする#7 変更後のコード
<?php if (get_comment_pages_count() > 1) {
echo '<ul id="comments-pagination">';
$previous_comments_link = get_previous_comments_link('<< 前のコメント');
$next_comments_link = get_next_comments_link('次のコメント >>');
if ( isset($previous_comments_link) ) {
echo '<li id="prev-comments">' . $previous_comments_link . '</li>';
}
if ( isset($next_comments_link) ) {
echo '<li id="next-comments">' . $next_comments_link . '</li>';
}
@hitsujixgit
hitsujixgit / comments.php
Created June 19, 2014 10:40
コメントフォームをカスタマイズする - index.phpをカスタマイズする#7 元のコード
<?php if ( get_comment_pages_count() > 1) : ?>
<ul id="pagination">
<li id="prev-comments"><?php previous_comments_link('&lt;&lt; 前のコメント'); ?></li>
<li id="next-comments"><?php next_comments_link('次のコメント &gt;&gt;'); ?></li> </ul>
<?php endif;