Skip to content

Instantly share code, notes, and snippets.

@hissy
hissy / wp-query-ref.php
Last active January 4, 2025 02:09 — forked from luetkemj/wp-query-ref.php
WP: Query $args
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.com
* Japanese translated by hissy
*
* CODEX: http://wpdocs.sourceforge.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/WP_Query#.E3.83.91.E3.83.A9.E3.83.A1.E3.83.BC.E3.82.BF
* Source: https://core.trac.wordpress.org/browser/tags/3.9/src/wp-includes/query.php
* Original: https://gist.github.com/luetkemj/2023628/9e911982440141a13cb1dd8ba1ad6b35cd7bbdd7
*/
@k-ishiwata
k-ishiwata / custom-meta-table.php
Created September 28, 2012 01:33
WordPressでカスタムフィールドの値をオリジナルのテーブル(DB)に保存する
<?php
/*
Plugin Name: Custom Meta Table
Plugin URI: http://www.webopixel.net/wordpress/637.html
Description: カスタムフィールドの値をオリジナルのテーブル(DB)に保存する
Author: k.ishiwata
Version: 0.1
Author URI: http://www.webopixel.net/
*/
class CustomMetaTable {
@ysugimoto
ysugimoto / mtk
Created March 18, 2013 08:37
mtkするやつ
#!/bin/sh
echo '玉子とじラーメン 650円(大盛800円)'
echo '玉子とじ担々麺 800円(大盛980円)'
echo 'もやしそば 750円(大盛980円)'
echo 'ワンタンメン 750円(大盛980円)'
echo '叉焼麺 800円(大盛980円)'
echo '天津麺 750円(大盛980円)'
echo '五目そば 750円(大盛980円)'
echo '酸辣湯麺 850円(大盛1000円)'
@hissy
hissy / gist:5581703
Created May 15, 2013 04:50
wp_reset_query と wp_reset_postdata のあれこれ
<?php
function query_posts($query) {
$GLOBALS['wp_query'] = new WP_Query();
return $GLOBALS['wp_query']->query($query);
}
@hissy
hissy / nav-menu-exporter-importer.php
Last active October 9, 2024 00:33
[WordPress Plugin] Nav Menu Exporter and Importer / Export and Import nav menus. Requires WordPress Importer plugin.
<?php
/*
Plugin Name: Nav Menu Exporter and Importer
Description: Export and Import nav menus. Requires WordPress Importer plugin
Author: hissy, megumi themes
Version: 0.1
Text Domain: nav-menu-exporter-importer
License: GPL version 2 or later - http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*/
@beijaflor
beijaflor / config.rb
Created April 14, 2014 16:12
compass setting to ask overwrite when it build as :production
# Require any additional compass plugins here.
# Set this to the root of your project when deployed:
http_path = "/"
css_dir = "css"
sass_dir = "sass"
images_dir = "img"
javascripts_dir = "js"
# You can select your preferred output style here (can be overridden via the command line):
@tkc49
tkc49 / gist:e1114c0e7203cb1a37bc
Last active August 16, 2017 06:21
タームをカスタマイズする際に必要なフック
<?php
public function plugins_loaded(){
add_action ( 'edited_term',array($this,'save_extra_category_fileds')); // 編集画面の保存
add_action ( 'created_term',array($this,'save_extra_category_fileds')); // 新規追加の保存
}
public function init(){
$args=array('public' => true,'_builtin' => false ); // builtin=false(WordPressが設定してるものは省く)
$output = 'names'; // or objects
@miya0001
miya0001 / gist:db3ce191e31871964a57
Last active October 21, 2017 02:14
テーマレビュワーのためのVCCW裏ワザ

初期設定

$ mkdir -p ~/vagrants/vccw
$ cd ~/vagrants/vccw
$ git clone [email protected]:miya0001/vccw.git .

次に以下のコードを~/.bash_profileに登録

@hissy
hissy / gist:0b8df0149fbba16be08d
Last active March 21, 2023 02:15
[Really Simple CSV Importer] 画像をインターネットからダウンロードして投稿に添付し、画像のIDをカスタムフィールドに登録
<?php
/*
Plugin Name: Really Simple CSV Importer Action add-on
Description: Run the additional action after importing the post data
Author: Takuro Hishikawa
Version: 0.1
*/
class rscsvimporter_action {
// singleton instance
@inc2734
inc2734 / gist:9f6d65c7473d060d0fd6
Last active April 30, 2022 09:26
smart-cf-register-fields のサンプル
<?php
/**
* カスタムフィールドを定義
*
* @param array $settings Smart_Custom_Fields_Setting オブジェクトの配列
* @param string $type 投稿タイプ or ロール
* @param int $id 投稿ID or ユーザーID
* @param string $meta_type post | user
* @return array
*/