Skip to content

Instantly share code, notes, and snippets.

View s-hiroshi's full-sized avatar

Hiroshi Sawai s-hiroshi

View GitHub Profile
@s-hiroshi
s-hiroshi / wp-eyecatch-images.md
Last active February 5, 2018 06:10
WordPress画像サイズをまとめたファイルです。

WordPressアイキャッチ画像メモ

サイズ設定

画像サイズ

画像サイズはthumbnail, medium, large, fullに加えアイキャッチが有効な場合はpost-thumbnailを指定できます。 (その他にも任意の幅、高さを配列で指定することも可)

  • 画像サイズ(ダッシュボード > 設定 > メディア)
@s-hiroshi
s-hiroshi / wp-single-paging.css
Last active March 17, 2016 11:21
WordPressシングルページのページングサンプルです。
/*doc
---
title: Single paging
name: single paging
category: Default
---
This class define single paging in single page.
* <- Previous Post
@s-hiroshi
s-hiroshi / wp-links-utils.php
Last active April 28, 2016 23:46
WordPressの汎用的なリンク処理をまとめたユーティリティークラスです。
@s-hiroshi
s-hiroshi / js-pageback.js
Last active April 13, 2016 05:51
JavaScriptで元の(前の)ページへ戻るサンプルです。
<div class="page-back">
<a href="#" onclick="history.back(); return false;">元のページへ戻る</a>
</div>
<div class="go-back">
<i class="fa fa-angle-double-left" aria-hidden="true"></i>
<a href="#" onclick="history.back(); return false;">前のページへ戻る</a>
</div>
@s-hiroshi
s-hiroshi / wp-loop-col-lg-4.php
Last active March 28, 2016 01:24
WordPressの投稿ループでBoostrapを使い3列表示するサンプルです。
<?php
global $posts;
$num = 1;
?>
<?php foreach ( $posts as $post ) : setup_postdata( $post ); ?>
<?php if ( 1 === $num || 1 === ( $num % 3 ) ) : ?>
<div class="row">
<?php endif; ?>
<div class="col-lg-4">
<div class="thumb-panel__img">
@s-hiroshi
s-hiroshi / test-wp-date-utils.php
Last active May 19, 2016 23:28
WordPressの汎用的な日付処理をまとめたユーティリティークラスです。
<?php
/**
* InfoTown_Utils_Dateテスト
*
* @package InfoTown
* @subpackage tests
* @author Hiroshi Sawai <info@info-town.jp>
* @copyright Hiroshi Sawai
* @version 1.0.0
* @since 1.0.0
@s-hiroshi
s-hiroshi / test-wp-categories-utils.php
Last active June 16, 2016 10:34
WordPressの汎用的なカテゴリー処理をまとめたユーティリティークラスです。
<?php
/**
* InfoTown_Categories_Utilsのテストクラス
*
* @package InfoTown
* @subpackage tests
* @author Hiroshi Sawai <info@info-town.jp>
* @copyright Hiroshi Sawai
* @version 1.0.0
* @since 1.0.0
@s-hiroshi
s-hiroshi / CUBE3-url-generator.php
Last active February 24, 2016 01:19
ルーティング名からURLを取得するスニペットです。
$url = $this->app['url_generator']->generate('ルーティング名');
/*
* WP REST API version 2.0-beta7
* API base url ishttp://www.example.com/wp-json
*
* Reference
* https://wordpress.org/support/topic/new-post-with-image
*/
/*
* Get Guzzle HTTP Client. That client has been authenticated.
*/
// スクリプトと同階層にあるdefault.logへvar_dumpの内容を出力します。
$file_info = pathinfo(__FILE__);
$file_dir = $file_info['dirname'];
ob_start();
var_dump('Hellow World');
$out = ob_get_contents();
ob_end_clean();
file_put_contents($file_dir .'/default.log', $out);