Skip to content

Instantly share code, notes, and snippets.

@konweb
konweb / Transients.php
Last active October 3, 2018 03:12
[Transients API settings] #PHP #WordPress
<?php
/**
*
* Transients API settings
*
*/
namespace THEME_NAME;
class Transients
@konweb
konweb / Datepicker.js
Last active October 3, 2018 03:22
[MW WP Form Element UI Datepicker] #PHP #WordPress
import Vue from 'vue'
import { DatePicker } from 'element-ui'
import langJa from 'element-ui/lib/locale/lang/ja'
import langEn from 'element-ui/lib/locale/lang/en'
import locale from 'element-ui/lib/locale'
import 'element-ui/lib/theme-chalk/index.css'
import moment from 'moment'
const pageLang = document.querySelector('html').getAttribute('lang')
const isJa = pageLang === 'ja'
@konweb
konweb / app.js
Last active April 17, 2019 14:19
Youtube iframe screen fit
$(() => {
$(window).on('resize', onResize).trigger('resize')
})
function onResize() {
const playerHeight = (9 / 16) * window.innerWidth
$player.toggleClass('is-vertical', window.innerHeight > playerHeight)
}
@konweb
konweb / README.md
Last active April 17, 2019 14:18
Git ftp

git-ftp

Install

 brew install git-ftp

Settings

git config git-ftp.dev.url ftp://:/
@konweb
konweb / functions.php
Last active March 30, 2020 07:32
Gutenberg Block Editor allowed block types
<?php
/**
* allowed blocks type
* Block List: https://en.support.wordpress.com/wordpress-editor/blocks/
*
* @param bool|array $allowed_block_types Array of block type slugs, or
* @param object The post resource data.
*/
function filter_allowed_block_types( $allowed_block_types, $post ) {
// echo '<pre>';
@konweb
konweb / style.scss
Last active April 17, 2019 14:17
Use Google Material Icons as a before&after
/*
* icon list: https://material.io/tools/icons/?style=baseline
* codepoints: https://github.com/google/material-design-icons/blob/master/iconfont/codepoints
*/
.icon {
&:before {
content: '\e315';
font-family: 'Material Icons';
}
}
@konweb
konweb / style.scss
Created February 14, 2019 14:35
br a one-byte space
br {
content: "";
margin-left: 5px;
}
@konweb
konweb / README.md
Last active April 17, 2019 14:20
Apache add a user to a group

list users

less /etc/group

add group user

gpasswd -a hogehoge apache
// Set the value of the custom variable '--vh' to the root of the document
document.documentElement.style.setProperty(
'--vh',
`${window.innerHeight * 0.01}px`
)
@konweb
konweb / function.php
Created March 8, 2019 02:52
Disabled Gutenberg Block Editor
<?php
// all
add_filter( 'use_block_editor_for_post', '__return_false' );
// Specific post types
add_filter( 'use_block_editor_for_post_type', 'disable_block_editor', 10, 2 );
function disable_block_editor( $use_block_editor, $post_type ) {
if ( $post_type === 'page' ) {
return false;
}