Skip to content

Instantly share code, notes, and snippets.

View kobaatsu's full-sized avatar

KOBAYASHI atsushi kobaatsu

View GitHub Profile
@kobaatsu
kobaatsu / WordPress用OGP生成.pug
Last active March 22, 2018 02:18
[OGP for Wordpress] 色々改変の余地あり #wordpress
| <?php
| $name_site = get_bloginfo('name');
| $url_parsed = parse_url(get_bloginfo('url'));
| $domain_site = $url_parsed['host'];
| $url_template = get_bloginfo('template_url');
| $title_page = '';
| if(!is_front_page()){
//- 前に謎のスペースが入るのでtrimする
@kobaatsu
kobaatsu / ellipsed_title.php
Last active March 22, 2018 02:49
[タイトルを以下略] #wordpress
function get_abbreviated_title($post_id, $num_char = 20, $ellips = '&hellip;') {
$title = get_the_title($post_id);
if ( mb_strlen($title, 'UTF-8') > $num_char ) {
$title = mb_substr($title, 0, $num_char, 'UTF-8') . $ellips;
}
return $title;
}
@kobaatsu
kobaatsu / sort.pug
Last active March 22, 2018 02:52
[objectをソートしてイテレーション]
- var menu = [{order:20, label:'foo'},{order:10, label:'bar'}]
- menu.sort((a,b)=>{return a.order > b.order ? 1 : -1})
each m in menu
li= m.label
@kobaatsu
kobaatsu / balloon.styl
Last active April 20, 2018 03:25
[フキダシ] 暫定版
balloon(position, size, color)
position relative
border 1px solid color
background-color #FFF
border-radius 5px
&::before
&::after
content ""
position absolute
width 0
@kobaatsu
kobaatsu / stroke.styl
Last active April 20, 2018 03:27
[文字の縁取り]
text-stroke(hoff = 1px, voff = 1px, blur = 0, color = #000)
text-shadow (-1 * hoff) (-1 * voff) blur color, hoff (-1 * voff) blur color, (-1 * hoff) voff blur color, hoff voff blur color
@kobaatsu
kobaatsu / include-filter.pug
Created May 28, 2018 06:22
[フィルタx読み込み]
style
include:stylus _maintenance/maintenance.styl
<?php
$tags = get_tags();
if ($tags) {
foreach($tags as $tag) {
// タグ名の出力
echo $tag->name.'';
// タグのスラッグ名の出力
echo $tag->slug.'';
// タグ名IDの出力
echo $tag->term_id.'';
@kobaatsu
kobaatsu / sns-color.styl
Last active August 22, 2018 02:39
[SNSカラー] #SNS
color-twitter = #55acee
color-facebook = #3B5998
color-googleplus = #C64B3F
color-line = #00C200
@kobaatsu
kobaatsu / admin_tag_selector.php
Created October 13, 2018 22:03
[管理画面でタグをセレクタから選択] #wordpress
<?php
// https://www.dctweb.jp/20150128k/
function tag_selector() {
global $wp_rewrite;
$rewrite = array(
'slug' => get_option('tag_base') ? get_option('tag_base') : 'tag',
'with_front' => ! get_option('tag_base') || $wp_rewrite->using_index_permalinks(),
'ep_mask' => EP_TAGS,
);
@kobaatsu
kobaatsu / circle-num.styl
Created July 8, 2019 08:56
[丸数字リスト] まず使わない
nums = ('\2780' '\2781' '\2782' '\2783' '\2784' '\2785' '\2786' '\2787' '\2788' '\2789')
for n, i in nums
li:nth-of-type({i+1})::before
content n