Skip to content

Instantly share code, notes, and snippets.

View Masamasamasashito's full-sized avatar

Masatoshi Nishimura Masamasamasashito

View GitHub Profile
@Masamasamasashito
Masamasamasashito / page-categorylist.php
Last active May 7, 2017 21:20
ワードプレスで3階層までカテゴリを固定ページテンプレートで表示
<!-- エスケープしていません! -->
<?php
/*
Template Name: カテゴリ一覧固定ページ
Template Post Type: page
*/
get_header();
?>
<!-- カテゴリマップ START -->
<div id="category-map">
@Masamasamasashito
Masamasamasashito / kintone-fieldcodes.js
Last active October 23, 2019 07:40
kintoneで手軽にフィールドコードをcosole.logで確認する
//グーグルクロームのディベロッパーツールのconsole.logで検証
//レコードが1件も登録されていないとエラーが出るので、1件以上レコードを登録してください。
(function(){
'use strict';
//レコード一覧画面
kintone.events.on('app.record.index.show', function(event) {
console.log('[Start FieldCodes]');
console.log(Object.keys(event.records[0]).join('\n'));
@Masamasamasashito
Masamasamasashito / kusanagi8.2.1-1 nginx.conf 20180308
Created March 8, 2018 05:34
kusanagi8.2.1-1 nginx.conf 20180308
## nginx.conf
user httpd www;
worker_processes auto;
worker_rlimit_nofile 20000;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
@Masamasamasashito
Masamasamasashito / gist:fe901b52c1e97c69c1a6b1d32bd7366b
Created May 29, 2018 06:48
kusanagi apache (httpd)でよく起こるやつ
[root@kusanagi71 DocumentRoot]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 火 2018-05-29 06:15:29 UTC; 19s ago
Process: 4094 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)</code>
5月 29 06:15:28 kusanagi71 systemd[1]: Starting The Apache HTTP Server...
5月 29 06:15:28 kusanagi71 apachectl[4094]: [Tue May 29 06:15:28.790072 2018] [so:warn] [pid 4096] AH01574: module headers_module is already loaded, skipping
5月 29 06:15:29 kusanagi71 apachectl[4094]: AH00526: Syntax error on line 27 of /etc/httpd/conf.d/プロファイル名_html_ssl.conf:
5月 29 06:15:29 kusanagi71 apachectl[4094]: SSLOpenSSLConfCmd: file '/etc/kusanagi.d/ssl/dhparam.key' does not exist or is empty
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# The most common configuration options are documented and commented below.
# For a complete reference, please see the online documentation at
<?php
if(get_post_meta($post->ID,'page_main_image',true)) {
if(is_mobile()){
if(get_post_meta($post->ID, 'page_main_image_mobile', true)){
$value = get_post_meta($post->ID, 'page_main_image_mobile', true);
}else{
$value = get_post_meta($post->ID, 'page_main_image', true);
}
$image = wp_get_attachment_image_src($value, 'full');
}else{
@Masamasamasashito
Masamasamasashito / ad.php
Last active June 12, 2018 02:15
TCD Agent 033
<?php
class ml_ad_widget extends WP_Widget {
function __construct() {
$widget_ops = array( 'classname' => 'ml_ad_widget', 'description' => __('Show AdSense at random in front page.','tcd-w') );
$control_ops = array( 'id_base' => 'ml_ad_widget' );
parent::__construct( 'ml_ad_widget', __('AdSense (tcd ver)','tcd-w'), $widget_ops, $control_ops );
}
<?php
// Start class widget //
class styled_post_list1_widget extends WP_Widget {
// Constructor //
function __construct() {
$widget_ops = array( 'classname' => 'styled_post_list1_widget', 'description' => __('Displays styled post list.', 'tcd-w') ); // Widget Settings
$control_ops = array( 'id_base' => 'styled_post_list1_widget' ); // Widget Control Settings
parent::__construct( 'styled_post_list1_widget', __('Styled post list (tcd ver)', 'tcd-w'), $widget_ops, $control_ops ); // Create the widget
<?php
// Start class widget //
class styled_post_list2_widget extends WP_Widget {
// Constructor //
function __construct() {
$widget_ops = array( 'classname' => 'styled_post_list2_widget', 'description' => __('Displays styled post list.', 'tcd-w') ); // Widget Settings
$control_ops = array( 'id_base' => 'styled_post_list2_widget' ); // Widget Control Settings
parent::__construct( 'styled_post_list2_widget', __('Styled post list2 (tcd ver)', 'tcd-w'), $widget_ops, $control_ops ); // Create the widget
<?php
// Start class widget //
class google_search extends WP_Widget {
// Constructor //
function __construct() {
$widget_ops = array( 'classname' => 'google_search', 'description' => __('Displays Google Custom Search form.', 'tcd-w') ); // Widget Settings
$control_ops = array( 'id_base' => 'google_search' ); // Widget Control Settings
parent::__construct( 'google_search', __('Google Custom Search (tcd-w ver)', 'tcd-w'), $widget_ops, $control_ops ); // Create the widget