Skip to content

Instantly share code, notes, and snippets.

Kei Nomura mypacecreator

Block or report user

Report or block mypacecreator

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
@mypacecreator
mypacecreator / private-debug-log.php
Created Dec 20, 2018 — forked from webaware/private-debug-log.php
Enable WordPress debug log to a private folder not accessible from the web. See http://wordpress.stackexchange.com/q/84132/24260 for details and motivations. NB: currently needs to be manually edited to specify the private folder path;
View private-debug-log.php
<?php
/*
Plugin Name: Private Debug Log
Description: Enable debug log to a private folder not accessible from the web
Version: 0.0.1
Author: WebAware
Author URI: http://www.webaware.com.au/
*/
/*
@mypacecreator
mypacecreator / mtk
Last active Jul 30, 2018 — forked from ysugimoto/mtk
mtkするやつ
View mtk
#!/bin/sh
echo '玉子とじラーメン 730円(大盛900円)'
echo '玉子とじ担々麺 850円(大盛1030円)'
echo 'もやし麺 850円(大盛1030円)'
echo 'ワンタン麺 850円(大盛1030円)'
echo '叉焼麺 850円(大盛1030円)'
echo '天津麺 850円(大盛1030円)'
echo '五目麺 850円(大盛1030円)'
echo '替玉 180円'
@mypacecreator
mypacecreator / functions.php
Last active Mar 27, 2018
singleページの前後リンクの %link% 部分で、a要素の内側にさらにspanを入れる
View functions.php
<?php
/**
* 前後リンクの出力部分で、a要素の内側にさらにspanを入れる
*
* @param string $link Link permalink format.
*
* @return string
*/
function my_post_link( $link ) {
$link = preg_replace( '/<a href="(.+?)">(.+?)<\/a>/', '<a href="$1"><span>$2</span></a>', $link );
@mypacecreator
mypacecreator / functions.php
Last active Mar 27, 2018
wp_list_categories の出力で、カレント表示のclass名の変更と、a要素の内側にさらにspanを入れる
View functions.php
<?php
/**
* wp_list_categories の出力を支給HTMLに合わせて変更
* カレント表示のclass変更、a要素の内側にさらにspanを入れる
*
* @param string $output
*
* @return string
*/
function my_wp_list_categories( $output ) {
@mypacecreator
mypacecreator / custom-fields.php
Last active Mar 13, 2018
Smart Custom Fieldsでよくある都道府県のプルダウン項目を作る
View custom-fields.php
<?php //
$Setting->add_group(
'group-pref', false, array(
array(
'name' => 'cf_prefecture',
'label' => '都道府県(テキスト)',
'type' => 'select',
'choices' => array(
'北海道' => '北海道',
'青森県' => '青森県',
@mypacecreator
mypacecreator / .htaccess
Created Mar 12, 2018
CPI旧シェアードプランでTLS1.2に対応したPHPを使う
View .htaccess
AddHandler x-httpd-php528a .php
Options +SymLinksIfOwnerMatch
@mypacecreator
mypacecreator / refine-search-checkbox.php
Created Jan 15, 2018 — forked from yujiokayama/refine-search-checkbox.php
カスタム投稿タイプのカスタムタクソノミー(タグ)をチェックボックスで絞り込み検索
View refine-search-checkbox.php
<!--カスタム投稿のタグをチェックボックスで絞り込み-->
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>">
<label for="s" class="assistive-text">検索</label>
<h2>タグまたはカスタムタクソノミー</h2>
<?php
$taxonomy_name = 'cpt_tag';
$taxonomys = get_terms($taxonomy_name);
if(!is_wp_error($taxonomys) && count($taxonomys)):
foreach($taxonomys as $taxonomy):
$tax_posts = get_posts(array('post_type' => get_post_type('cpttype'), 'taxonomy' => $taxonomy_name, 'term' => $taxonomy->slug ) );
@mypacecreator
mypacecreator / archive-faq.php
Last active Oct 18, 2017
get_termsとget_postsの入れ子例 改(複数タームに属する記事は2回登場しないように)
View archive-faq.php
<?php
$displayed_post_id = array();
$terms = get_terms(
'faqcategory', array(
'orderby' => 'slug',
'order' => 'ASC'
)
);
foreach( $terms as $term ):
?>
@mypacecreator
mypacecreator / sns.php
Last active Oct 2, 2017
シェア系ボタンを自作し、数値はSNS Count Cacheプラグインから出力&自力でHTTP時のいいね数を合算
View sns.php
<?php if( function_exists( 'scc_get_share_facebook' ) ){
$https_count = scc_get_share_facebook();
$http_count = get_post_meta( get_the_ID(), 'scc_http_count_facebook', true );
$total_count = $https_count + $http_count;
} ?>
<div class="social-buttons">
<a href="https://twitter.com/share?url=<?php echo esc_url( get_the_permalink() ); ?>&text=<?php echo urlencode( get_the_title() . ' | ' . get_bloginfo( 'name' ) ); ?>" rel="nofollow" onclick="window.open(this.href, 'tweetwindow', 'width=650, height=470, personalbar=0, toolbar=0, scrollbars=1, sizable=1'); return false;" class="social-btn twitter">
<i class="fa fa-twitter"></i>ツイート
</a>
<a href="https://plus.google.com/share?url=<?php echo esc_url( get_the_permalink() ); ?>" rel="nofollow" class="social-btn gplus">
@mypacecreator
mypacecreator / functions.php
Last active Mar 3, 2017
meta, title関連でよく頼まれるやつ
View functions.php
<?php
//og:titleにサイト名を入れたいと言われた時用
function custom_open_graph_title( $og_tags ) {
if( is_home() ){
$og_tags['og:title'] = 'ブログ|' . get_bloginfo( 'name' );
} elseif ( !is_front_page() ){
$og_tags['og:title'] .= '' . get_bloginfo( 'name' );
}
return $og_tags;
}
You can’t perform that action at this time.