Skip to content

Instantly share code, notes, and snippets.

wada wadadanet

Block or report user

Report or block wadadanet

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@wadadanet
wadadanet / wodpress_json_ld_page.php
Last active Aug 8, 2019
wordpress JSON-LD example
View wodpress_json_ld_page.php
<?php
$type = "WebPage"; // BlogPosting, WebSite, Article, Person, SearchAction, NewsArticle
$author_name = get_the_author_meta('display_name');
$logo_url = "https://www.coffee-break-designs.com/wp-content/themes/coffee-break-designs-v8/img/logo.svg";
$description = get_post_meta(get_the_id(), "_aioseop_description", true);
$thumbnail_id = get_post_thumbnail_id();
$imageobject = wp_get_attachment_image_src( $thumbnail_id, 'full' );
?>
<script type="application/ld+json">
{
@wadadanet
wadadanet / function.php
Created Jul 12, 2019
wordpress shortcode "not break"
View function.php
function shortcode_not_break($atts, $content = null){
return do_shortcode(preg_replace('/(]<br>|]<br \/>)/', ']', $content));
}
add_shortcode('not_break', 'shortcode_not_break');
View mp4_gif.bat
@echo off
cd /d "%~dp0"
if "%~1" == "" goto error
mkdir "%~dp1gif\"
:loop
if not "%~nx1"=="" (
echo ---- %~nx1 ffmpeg...
@wadadanet
wadadanet / mozcjpeg
Created Jul 8, 2019
macのAutomatorで一括mozcjpeg処理をするシェルスクリプト
View mozcjpeg
#!/bin/sh
for f in "$@"
do
mkdir -p "$(dirname $f)/mozcjpeg"
/usr/local/bin/mozcjpeg $f &gt; "$(dirname $f)/mozcjpeg/$(basename $f)"
dir="$(dirname $f)/mozcjpeg"
done
osascript -e "display notification \"$dir\" with title \"mozcjpeg complete!\""
@wadadanet
wadadanet / 00-sass-color-setting.scss
Last active May 23, 2019
css変数も出力できるsass設定
View 00-sass-color-setting.scss
$theme-colors: (
primary: #ffffff,
secondary: #cccccc,
success: #28a745,
info: #aaaaaa,
warning: #ffc107,
danger: #dc3545,
light: #f8f9fa,
dark: #343a40
);
@wadadanet
wadadanet / main.sass
Created Mar 15, 2019
Bootstrap4 Grid system 5,7 column
View main.sass
.col-c5
width: 20%
position: relative
min-height: 1px
padding-right: 15px
padding-left: 15px
.col-c7
width: #{(100% / 7)}
position: relative
min-height: 1px
View bootstrap gutter
// bootstrap gutter
// ex: .row.gutter-10
@for $num from 1 through 5
$v: $num * 5px / 2
.gutter-#{$num*5}
margin-left: #{$v * -1}
margin-right: #{$v * -1}
> [class*='col-']
padding-left: $v
padding-right: $v
View functions.php
/**
* lazysizes対応のattachment_image_attributes
*/
function lazysizes_attachment_image_attributes( $atts, $attachment ) {
if(!empty($atts['class'])){
if(strpos($atts['class'], 'lazyload') !== false){
$atts['data-src'] = $atts['src'];
$atts['src'] = 'data:image/gif;base64,R0lGODlhAQABAGAAACH5BAEKAP8ALAAAAAABAAEAAAgEAP8FBAA7';
if(!empty($atts['srcset'])) {
$atts['data-srcset'] = $atts['srcset'];
View functions.php
add_action( 'wp_enqueue_scripts', 'mb_scripts' );
function mb_scripts() {
wp_enqueue_script( 'lazysizes', get_template_directory_uri() . '/js/vendor/lazysizes.min.js', NULL, NULL, true );
}
@wadadanet
wadadanet / functions.php
Created Jun 7, 2018
wordpress 知りたい要素のファイルを一瞬で調べる方法
View functions.php
function echo_filename(){
if(WP_DEBUG){
$obj = debug_backtrace();
$parent = $obj[0];
$path = $parent['file'];
$filename = basename($path);
echo "<!-- $filename -->";
}
}
You can’t perform that action at this time.