Last active
August 29, 2015 14:21
-
-
Save kurozumi/d03e8cb0f8c35fe6eddf to your computer and use it in GitHub Desktop.
【ワードプレス】WordPress Popular Postsを多言語化サイトが構築できるBogoプラグインに対応させる方法
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
// Bogo support | |
if(isset($instance['bogo_locales'])){ | |
$from .= " LEFT JOIN {$wpdb->postmeta} AS postmeta_bogo ON (p.ID = postmeta_bogo.post_id AND postmeta_bogo.meta_key = '_locale')"; | |
$tmp_where = array(); | |
foreach($instance['bogo_locales'] as $locale) | |
{ | |
if ( bogo_is_default_locale( $locale ) ) | |
$tmp_where[] = "postmeta_bogo.meta_id IS NULL"; | |
$tmp_where[] = "postmeta_bogo.meta_value = '{$locale}'"; | |
} | |
$where .= sprintf(" AND (%s)", implode(" OR ", $tmp_where)); | |
} | |
// Build query | |
$query = "SELECT {$fields} FROM {$from} {$where} {$groupby} {$orderby} {$limit};"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment