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 | |
/** | |
* 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 | |
*/ |
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
/*----------------------------------- | |
お知らせ表示ショートコード | |
[news num="5" cat="news" showcat=""] | |
-----------------------------------*/ | |
function getNewItems($atts) { | |
extract(shortcode_atts(array( | |
"num" => '', //最新記事リストの取得数 | |
"cat" => '', //表示する記事のカテゴリー指定 | |
"showcat" => '' //カテゴリー表示の有無 | |
), $atts)); |
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
$category = get_the_category(); | |
$cat_id = $category[0]->cat_ID; | |
$cat_name = $category[0]->cat_name; | |
$cat_slug = $category[0]->category_nicename; | |
$category_link = get_category_link( $cat_id ); |
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
$taxonomy = 'タクソノミー名'; | |
$terms = wp_get_post_terms( $post->ID, $taxonomy ); | |
if ( $terms && ! is_wp_error( $terms ) ): | |
foreach ( $terms as $term ): | |
$term_id = $term->term_id; | |
$term_name = $term->name; | |
$term_slug = $term->slug; | |
$term_link = get_term_link( $term_id, $taxonomy ); | |
endforeach; | |
endif; |
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
//サイトのURLを変更する | |
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
//画像のパスを変更する | |
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://www.oldsiteurl.com', 'http://www.newsiteurl.com'); | |
//Metaを変更 | |
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://www.oldsiteurl.com','http://www.newsiteurl.com'); | |
//デフォルトのユーザー名である「admin」を変更する |
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
///////////////////////////////////////////// | |
//コピペ一発でWordpressの投稿時にアイキャッチを自動設定するカスタマイズ方法(YouTube対応版) | |
//http://nelog.jp/auto-post-thumbnail-custum | |
///////////////////////////////////////////// | |
//WP_Filesystemの利用 | |
require_once(ABSPATH . '/wp-admin/includes/image.php'); | |
//イメージファイルがサーバー内にない場合は取得する |
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
//<head>に読み込み | |
<link rel="stylesheet" href="tingle.min.css"> | |
//</body>直前に読み込み | |
<script src="tingle.min.js"></script> | |
<script> | |
var modal1 = new tingle.modal({ cssClass: ['modal1'] }); | |
modal1.setContent(document.getElementById('modal1_html').innerHTML); | |
</script> |
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
//<head>に読み込み | |
<link rel="stylesheet" href="https://unpkg.com/smartphoto@0.5.9/css/smartphoto.min.css"> | |
//</body>直前に読み込み | |
<script src="https://unpkg.com/smartphoto@0.5.9/js/smartphoto.min.js"></script> | |
<script> | |
window.addEventListener('DOMContentLoaded',function(){ | |
new smartPhoto(".js-smartPhoto"); | |
}); |
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
/*----------------------------------- | |
アイキャッチ付き | |
News表示ショートコード | |
[news num="5"] | |
-----------------------------------*/ | |
function getNewsItems($atts) { | |
extract(shortcode_atts(array( | |
"num" => '', //最新記事リストの取得数 | |
), $atts)); | |
global $post; |
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 | |
/*----------------------------------- | |
wp_head(),wp_footer()にJS,CSSを読み込み | |
-----------------------------------*/ | |
function add_files() { | |
if ( is_admin() ) return; | |
//共通 | |
wp_deregister_script('jquery'); | |
wp_enqueue_script('jquery', SITEURL.'/js/jquery.min.js',array(), '', false); |
OlderNewer