Skip to content

Instantly share code, notes, and snippets.

View inc2734's full-sized avatar

Takashi Kitajima inc2734

View GitHub Profile
@inc2734
inc2734 / gist:9f7a2c2998f546056e1e30c1f150d296
Created August 17, 2020 04:55
Snow Monkey の固定ページにシェアボタンを追加する
add_filter(
'snow_monkey_template_part_render',
function( $html, $slug, $name ) {
if ( 'template-parts/content/entry/content/content' === $slug && 'page' === $name ) {
$share_buttons_display_position = get_option( 'mwt-share-buttons-display-position' );
$share_buttons = get_option( 'mwt-share-buttons-buttons' );
ob_start();
if ( in_array( $share_buttons_display_position, [ 'top', 'both' ] ) && $share_buttons ) {
@inc2734
inc2734 / .scss
Last active June 13, 2020 04:22
Snow Monkey を雑に左メニュー固定レイアウトにする
@media (min-width: 1024px) {
.l-header {
position: fixed;
top: 0;
left: 0;
bottom: 0;
width: 300px;
}
.admin-bar .l-header {
@inc2734
inc2734 / gist:c7d669967f16082ef48e985b848733d0
Created August 27, 2019 10:55
MW WP Form Generator 利用時に確認画面を挟まないようにする
<?php
add_filter(
'mw-wp-form-generator-content',
function( $content ) {
return str_replace( '[mwform_backButton] [mwform_submitButton]', '[mwform_submit]', $content );
},
11
);
"css:style": "node-sass --include-path=node_modules/node-normalize-scss resources/src/css/style.scss resources/assets/css/style.css && postcss resources/assets/css/style.css -o resources/assets/css/style.css --no-map -c=postcss.config.js && cssnano resources/assets/css/style.css resources/assets/css/style.min.css --no-zindex"
public function _set_preload_stylesheet( $tag, $handle, $src ) {
$handles = apply_filters( 'inc2734_wp_page_speed_optimization_output_head_styles', [] );
if ( in_array( $handle, $handles ) && 0 === strpos( $src, home_url() ) ) {
$sitepath = site_url( '', 'relative' );
$abspath = untrailingslashit( ABSPATH );
if ( $sitepath ) {
$abspath = preg_replace( '|(.*?)' . preg_quote( $sitepath ) . '$|', '$1', $abspath );
}
@inc2734
inc2734 / test-sample.php
Created February 15, 2017 06:24
ぺちぱな用サンプルテストコード
<?php
/**
* Class SampleTest
*
* @package Sample_Plugin
*/
/**
* Sample test case.
*/
@inc2734
inc2734 / sample-plugin.php
Last active February 15, 2017 06:23
ぺちぱな用サンプルプラグイン
<?php
/**
* Plugin Name: Sample Plugin
* Plugin URI: PLUGIN SITE HERE
* Description: PLUGIN DESCRIPTION HERE
* Author: YOUR NAME HERE
* Author URI: YOUR SITE HERE
* Text Domain: sample-plugin
* Domain Path: /languages
* Version: 0.1.0
@inc2734
inc2734 / .php
Created January 29, 2017 06:56
Customizer Framework sample
<?php
$Customizer_Framework = new Customizer_Framework\Customizer_Framework();
$Panel = $Customizer_Framework->Panel( 'panel-name2', [
'title' => 'panel-name2',
] );
$Section = $Customizer_Framework->Section( 'section-name', [
'title' => 'section-name',
] );
<?php
class TemplatePart {
protected $template;
protected $slug;
protected $vars = array();
protected $WP_Query;
public function __construct( $template, $slug = '' ) {
global $wp_query;
@inc2734
inc2734 / .php
Created April 26, 2016 05:02
Smart Custom Fields リレーションフィールドの速度調査
<?php
class Smart_Custom_Fields_Test_Sample extends WP_UnitTestCase {
/**
* @var int
*/
protected $post_id;
/**
* setUp