Skip to content

Instantly share code, notes, and snippets.

View Olein-jp's full-sized avatar
🏠
Working from home

Koji Kuno Olein-jp

🏠
Working from home
View GitHub Profile
@Olein-jp
Olein-jp / style.css
Created May 27, 2017 12:49
style.css template for developing WordPress theme
/*
Theme Name: テーマの名前(必須)
Theme URL: テーマのサイトのURI
Description: テーマの説明
Author: 作者の名前
Version: テーマのバージョン
Tags: テーマの特徴を表すタグ(カンマ区切り/オプション)
License: テーマのライセンス
License URI: テーマのライセンスのURI
*/
@Olein-jp
Olein-jp / functions.php
Created June 8, 2018 01:58
子テーマから親テーマのCSSを呼び出す
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
@Olein-jp
Olein-jp / style.css
Created June 8, 2018 02:16
子テーマのスタイルシートヘッダーサンプル
/*
Theme Name: TwentySeventeen Child
Theme URI: http://example.com/twenty-seventeen-child/
Description: Twenty Seventeen Child Theme
Author:
Author URI: http://olein-design.com
Template: twentyseventeen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@Olein-jp
Olein-jp / wp_query_example
Last active November 25, 2019 05:20
WP_Queryで出力する際のサンプル
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
* Japanese translated by hissy
*
* CODEX: http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/WP_Query#.E3.83.91.E3.83.A9.E3.83.A1.E3.83.BC.E3.82.BF
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
* Original: https://gist.github.com/luetkemj/2023628/9e911982440141a13cb1dd8ba1ad6b35cd7bbdd7
*/
@Olein-jp
Olein-jp / slickjs-js
Last active November 21, 2019 05:12
Slick.jsを利用する際に使うJS
// $(function() { 静的サイトで利用するならこちら
jQuery(function($){ // WordPressで利用するならこちら
$('#target').slick({
accessibility: true, // キーボードでの操作を可能にするかどうか
adaptiveHeight: false, // スライダーの高さを.slick-currentに合わせるかどうか
autoplay: false, // スライダーの自動再生
autoplaySpeed: 3000, // 自動再生時のスライド静止時間
arrows: true, // 「前へ」と「次へ」の矢印ボタンの有無
@Olein-jp
Olein-jp / wp-bootstrap4.1-pagination.php
Created October 16, 2018 13:10 — forked from mtx-z/wp-bootstrap4.4-pagination.php
Wordpress Bootstrap 4.1 pagination (with custom WP_Query() and global $wp_query support)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
*
* @return string
* Accepts a WP_Query instance to build pagination (for custom wp_query()),
* or nothing to use the current global $wp_query (eg: taxonomy term page)
* - Tested on WP 4.9.5
{
"name": "oleinpress-weblog",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"browsersync": "browser-sync start -p 'oleinpressweblog.wordpress' -f '**/*' 'assets/**'",
"cleanup:css": "rimraf assets/css && mkdir -p assets/css",
"cleanup:js": "rimraf assets/js && mkdir -p assets/js",
"cleanup:images": "rimraf assets/images && mkdir -p assets/images",
/*--------------------------------------------------------------
style for WP Pagenavi plugin
--------------------------------------------------------------*/
.p-pagenavi {
.wp-pagenavi {
.page {
}
.previouspostslink {
}
.page.smaller {
$paged = get_query_var('paged')? get_query_var('paged') : 1; //pagedに渡す変数
$args = array(
'post_type' => 'program',
'posts_per_page' => 5, //posts_per_pageの指定
'paged' => $paged, //pagedの指定
);
$the_query = new WP_Query($args);
if ($the_query->have_posts()) :
while ($the_query->have_posts()) : $the_query->the_post();