get_results('SELECT ID, post_type,post_name FROM '.$table_prefix.'posts WHERE post_type IN ("page", "post") AND post_status="publish"'); foreach($a as$v){ if($v->post_type=='post'){ $c = wp_get_post_categories($v->ID); $IS_LECTURER_POST = false; foreach($c as$cat_id){if($cat_id==LECTURER_CAT_ID){$IS_LECTURER_POST = true;break;}} } if($IS_LECTURER_POST){ $uri = LECTURER_URI_PREFIX.$v->post_name; }else{ $uri = WEB_URL.$v->post_name; } $ary[] = $uri; } echo implode('`',$ary); exit;