This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add locale such as locale_ja, locale_en_US to body class | |
add_filter( 'body_class', 'add_body_class_locale' ); | |
function add_body_class_locale( $classes ) { | |
$classes[] = 'locale_' . sanitize_html_class( get_bloginfo('language') ); | |
return $classes; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'the_content', 'my_pre_shortcode', 7 ); | |
function my_pre_shortcode( $content ) { | |
global $shortcode_tags; | |
$shortcode_tags_org = $shortcode_tags; | |
remove_all_shortcodes(); | |
add_shortcode( 'code', 'code_shortcode_handler' ); | |
$content = do_shortcode( $content ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package content_mayuge_systems | |
* @version 0.2 | |
*/ | |
/* | |
Plugin Name: Content Mayuge Systems | |
Plugin URI: http://wordpress.org/extend/plugins/hello-dolly/ | |
Description: 本文中に句点「。」があると「( ・ิω・)╯ิ」がくっつきます。 | |
Author: gatespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// エディタの下にテキストエリアを追加 | |
add_action( 'edit_form_after_editor', 'nskw_postMetaAfterEditor' ); | |
function nskw_postMetaAfterEditor() { | |
global $post; | |
$metaKey = 'afterEditor'; | |
if ( empty ( $post ) || 'post' !== get_post_type( $GLOBALS['post'] ) ) { | |
return; | |
} | |
if ( ! $content = get_post_meta( $post->ID, $metaKey, TRUE ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// アイキャッチ | |
add_theme_support('post-thumbnails'); | |
// set_post_thumbnail_size(443, 171, true); | |
// その他の画像サイズ | |
//add_image_size( 'sizename', 100, 100, true ); | |
// jQuery の差し替えとその他のJSの登録 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// タイトル下にタイトル2を追加 | |
add_action( 'edit_form_after_title', 'nskw_postMetaAfterTitle' ); | |
function nskw_postMetaAfterTitle() { | |
global $post; | |
$metaKey = 'title2'; | |
if ( empty ( $post ) || 'post' !== get_post_type( $GLOBALS['post'] ) ) { | |
return; | |
} | |
if ( ! $content = get_post_meta( $post->ID, $metaKey, TRUE ) ) { | |
$content = ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// タクソノミ取得 | |
$catargs = array( | |
'taxonomy' => 'specialcat' | |
); | |
$catlists = get_categories( $catargs ); | |
foreach($catlists as $cat) : // 取得したカテゴリの配列でループを回す | |
/* | |
// タクソノミひとつひとつのオブジェクトの中身を見る | |
if ( is_user_logged_in() ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 投稿一覧で表示する項目を操作する | |
function manage_posts_columns($columns) { | |
unset($columns['tags']); | |
unset($columns['comments']); | |
global $post; | |
if ( $post->post_type == 'post' ) { // ポストタイプが投稿の時だけ | |
$date_escape = $columns['date']; // いったん避難 | |
unset($columns['date']); // 消す | |
$columns['district'] = '地区'; | |
$columns['date'] = $date_escape; // ここで戻すと日付が最後になる |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// category の場合 | |
$what = get_term_by( 'name', $_GET['what'], 'category', 'ARRAY_A' ); | |
// district というタクソノミの場合 | |
$where = get_term_by( 'name', $_GET['where'], 'district', 'ARRAY_A' ); | |
// https://gist.github.com/4139337 これが長い方 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// example.com?what=abc&where=xyz | |
// category | |
$what = $_GET['what']; | |
$okCats = get_categories(); | |
foreach ( $okCats as $oks ) { | |
$okCatsArr[] = $oks->name; | |
} | |
$ifWhat = in_array($what, $okCatsArr); |