Skip to content

Instantly share code, notes, and snippets.

@wadadanet
wadadanet / example.pug
Created February 28, 2020 01:20
比率を保ったスペースを開ける
.ratio_space-golden
img.ratio_space__img(src="./img/main.jpg")
@wadadanet
wadadanet / canUseWebP.js
Created February 26, 2020 07:21
ブラウザがWebPをサポートしているかどうか
export default function() {
var elem = document.createElement('canvas')
if (!!(elem.getContext && elem.getContext('2d'))) {
// was able or not to get WebP representation
return elem.toDataURL('image/webp').indexOf('data:image/webp') == 0
}
// very old browser like IE 8, canvas not supported
return false
@wadadanet
wadadanet / index.html
Last active January 7, 2020 07:22
【初心者】Webサイト作る #4 「CSSの基礎」
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>My test page</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
@wadadanet
wadadanet / bootstrap-setting.scss
Created December 13, 2019 07:44
bootstrap4の設定例
$theme-colors: (
primary: #3D7CE4,
);
$grid-breakpoints: (
// Extra small screen / phone
xs: 0,
// Small screen / phone
sm: 576px,
// Medium screen / tablet
@wadadanet
wadadanet / style.scss
Last active November 22, 2019 05:36
fukidashi用のstyle
.wp-block-cgb-block-fukidashi-block {
padding: 0.1rem;
display: flex;
justify-content: space-between;
align-items: flex-start;
background-color: transparent;
.image {
width: 70px;
.wp-block-image:not(.alignwide):not(.alignfull):not(.alignleft):not(.alignright):not(.aligncenter),
.aligncenter {
@wadadanet
wadadanet / functions.php
Created November 22, 2019 05:30
fukidashi-block
function fukidashi_block_cgb_block_assets() { // phpcs:ignore
// Register block styles for both frontend + backend.
$block_url = get_stylesheet_directory_uri() . "/fukidashi-block/dist";
wp_register_style(
'fukidashi_block-cgb-style-css', // Handle.
"$block_url/blocks.style.build.css",
array( 'wp-editor' ), // Dependency to include the CSS after it.
null // filemtime( plugin_dir_path( __DIR__ ) . 'dist/blocks.style.build.css' ) // Version: File modification time.
);
@wadadanet
wadadanet / block.js
Created November 22, 2019 02:45
フキダシ用GutenbergBlock
/**
* BLOCK: fukidashi-block
*
* フキダシ表示ができるブロック
*/
// Import CSS.
import './editor.scss';
import './style.scss';
@wadadanet
wadadanet / functions.php
Created November 20, 2019 02:02
twentytwentyの子テーマ(twentytwenty-child)
<?php
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function theme_enqueue_styles() {
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
}
@wadadanet
wadadanet / archive-news.php
Last active November 15, 2019 08:40
新着情報一覧表示
<ul>
<?php if ( have_posts() ): ?>
<?php while ( have_posts() ) : the_post();?>
<?php get_template_part( 'template-parts/item', 'news' ); ?>
<?php endwhile; ?>
<?php endif;?>
</ul>
@wadadanet
wadadanet / cpt_news.php
Last active November 15, 2019 08:15
Wordpress CPT 新着情報
function cptui_register_my_cpts_news() {
/**
* Post Type: 新着情報.
*/
$labels = [
"name" => __( "新着情報", "twentytwenty" ),
"singular_name" => __( "新着情報", "twentytwenty" ),
];