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 | |
function get_prev_post_cf($link="« %link", $title="%title", $post_type="post", $meta_key, $meta_value, $label) { | |
global $wpdb, $post; | |
$prev = $wpdb->get_row($wpdb->prepare(" | |
SELECT ID, post_title | |
FROM $wpdb->posts p | |
LEFT OUTER JOIN $wpdb->postmeta pm on p.ID = pm.post_id | |
WHERE post_type = '{$post_type}' | |
AND post_status = 'publish' | |
AND post_date < '".$post->post_date."' |
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 | |
$array = array( | |
'1/10/2014', | |
'1/11/2014', | |
'1/12/2014', | |
'1/13/2014', | |
'1/14/2014' | |
); | |
$array = array_filter($array,function($date){ |
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
jQuery(function(){ | |
var wrap = "#" + thisPanelId + ' .postcontent-inner'; | |
var wrapHeight = jQuery(wrap).outerHeight(true); | |
var container = "#" + thisPanelId + ' .postcontent-box'; | |
var target = "#" + thisPanelId + ' .postcontent-box .sec-post'; | |
var offset = wrapHeight * 0.25; // 25% Height | |
jQuery(target).first().addClass("inview"); | |
jQuery(target).each(function(){ | |
var pTop = jQuery(this).position().top - wrapHeight + offset; | |
var pBtm = jQuery(this).position().top + jQuery(this).outerHeight(true) - offset; |
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 | |
function mb_trim($str) { | |
static $chars = "[\\x0-\x20\x7f\xc2\xa0\xe3\x80\x80]"; | |
return preg_replace("/\A{$chars}++|{$chars}++\z/u", '', strip_tags($str)); | |
} | |
$content = mb_trim(get_the_content()); | |
if($content === ""){ | |
echo '<p>Empty Content</p>'; | |
}else{ |
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 | |
function get_the_terms( $post, $taxonomy ) { | |
if ( ! $post = get_post( $post ) ) | |
return false; | |
$terms = get_object_term_cache( $post->ID, $taxonomy ); | |
if(false === $terms || empty($terms)){ | |
$terms = wp_get_post_terms( $post->ID, $taxonomy ); | |
if ( ! is_wp_error( $terms ) ) { |
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 | |
/*================================================== | |
"get_the_terms" to the order of the "term_order". (order by ASC.) | |
================================================== */ | |
function get_the_terms_orderby_termorder($taxonomy){ | |
global $post; | |
$terms = get_the_terms($post->ID, $taxonomy); | |
$array = array(); | |
foreach($terms as $term){ | |
$array[$term->term_order] = (object)array( |
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 | |
function remove_administrator($users) | |
{ | |
foreach ($users as $key => $user) { | |
$cap = reset($user->roles); | |
if ($cap === 'administrator') { | |
unset($users[$key]); | |
} | |
} | |
return $users; |
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 | |
function is_single_paged($page){ | |
global $wp_query; | |
if(!is_preview()){ | |
$paged = (get_query_var('page')) ? get_query_var('page') : 1; | |
}else{ | |
$pagenum = $_GET['paged']; | |
$paged = ($pagenum) ? $pagenum : 1; | |
$wp_query->query = array('p' => $post->ID, 'page' => $paged, 'preview' => true, 'post_type' => get_post_type() ); | |
$wp_query->set('paged', $paged); |
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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery-form-validator/2.2.43/jquery.form-validator.min.js"></script> | |
<script> | |
var japanese = { | |
errorTitle: 'フォームの送信に失敗しました', | |
requiredFields: 'すべての必須フィールドに答えていません', | |
badTime: '時間が正しくありません', | |
badEmail: 'メールアドレスが正しくありません', | |
badTelephone: '電話番号が正しくありません', | |
badSecurityAnswer: 'セキュリティの質問の答えが正しくありません', |
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 new user column: Expire Date. | |
* | |
* @since 1.0.0 | |
* @return array $columns | |
*/ | |
function prefix_expire_date_column( $columns ) { | |
$columns['expire_date'] = __( 'Expire Date', 'text-domain' ); | |
return $columns; |
OlderNewer