Fix WPML compatibility

This commit is contained in:
champsupertramp
2016-03-20 20:02:06 +08:00
parent 4a96c60149
commit 432c0fa01a
6 changed files with 88 additions and 40 deletions
+10 -6
View File
@@ -12,16 +12,20 @@ class UM_Query {
*** @get wp pages
***/
function wp_pages() {
$count_pages = wp_count_posts('page');
global $wpdb;
$pages = $wpdb->get_results('SELECT * FROM '.$wpdb->posts.' WHERE post_type = "page" AND post_status = "publish" ', OBJECT);
$count_pages = $wpdb->num_rows;
if ( $count_pages->publish > 300 )
return;
if ( $count_pages > 300 )
return 'reached_maximum_limit';
$pages = get_pages();
$array = '';
foreach ($pages as $page_data) {
$array[ $page_data->ID ] = $page_data->post_title;
if( $wpdb->num_rows > 0 ){
foreach ($pages as $page_data) {
$array[ $page_data->ID ] = $page_data->post_title;
}
}
return $array;
}