다음 함수가 배열의 모든 하위 페이지를 출력하려고합니다. 모든 것이 잘 작동한다고해서 ASC에 주문을 올려야합니다.Wordpress는 오름차순으로 자식 페이지를 가져옵니다.
$my_wp_query->query(array('post_type' => 'page')); // This gives me everything
$my_wp_query->query(array('post_type' => 'page', 'order' => 'ASC')); // This gives me nothing
저는 WordPress에 새로 왔으며 한 시간 동안 Google에 알려 봤지만 찾을 수 없었습니다. 누구든지 도와주세요.
감사
function get_children_pages_by_page_title($page_title = ''){
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page', 'order' => 'ASC'));
$page_title = empty($page_title) ? get_page_by_title() : $page_title;
$portfolio = get_page_by_title($page_title);
$portfolio_children = get_page_children($portfolio->ID, $all_wp_pages);
return $portfolio_children;
}
Works !!! 고맙습니다. – what