Skip to content

Instantly share code, notes, and snippets.

@sou-lab
sou-lab / functions.php
Created July 28, 2016 19:18
キャプションショートコードのfigureにaria-labelledbyを、figcaptionにそのidを付ける
<?php
//キャプションにaria-labelledbyを付ける
add_shortcode('caption', 'my_img_caption_shortcode');
function my_img_caption_shortcode( $attr, $content = null ) {
// New-style shortcode with the caption inside the shortcode with the link and image tags.
if ( ! isset( $attr['caption'] ) ) {
if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
$content = $matches[1];
$attr['caption'] = trim( $matches[2] );
@sou-lab
sou-lab / reverse.scss
Created September 19, 2016 10:23
reverse a list
//配列をリバース
@function reverse($list) {
$result: ();
@for $i from length($list)*-1 through -1 {
$result: append($result, nth($list, abs($i)), comma);
}
@return $result;
}
@sou-lab
sou-lab / SassMeister-input.scss
Created October 12, 2016 06:02
Generated by SassMeister.com.
// ----
// libsass (v3.3.6)
// ----
$z-index:(
// ↑レイヤー上
child,
pulldown,
nav,
header