Title: WP_Query issue/question?
Last modified: August 19, 2016

---

# WP_Query issue/question?

 *  [brian914](https://wordpress.org/support/users/brian914/)
 * (@brian914)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/wp_query-issuequestion/)
 * I am trying to create links to only pages found in section 11, but seem to not
   be able to with what I have so far. I am trying to do it via the following, but
   I think something is not quite right the way I have the array in the beginning?
   What am I doing wrong?
 *     ```
       <?php
       	$query = array (
       		'child_of' => 11,
       		 'sort_column' => 'post_title',
       	   	 'post_type' => 'page'
       	);
   
       	$queryObject = new WP_Query($query);
   
       	if ($queryObject->have_posts()) {
       		while ($queryObject->have_posts()) {
       			$queryObject->the_post();
       			the_title();
       		}
       	}
   
       	wp_reset_query();
       ?>
       ```
   
 * Thank you very much for any help with this!!!

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/wp_query-issuequestion/#post-2052348)
 * what is the code doing?
 * obvioulsly, there is no link html code in the above, so far.
 * is it showing the titles of the child pages of page 11?
 * link to your site?
 *  Thread Starter [brian914](https://wordpress.org/support/users/brian914/)
 * (@brian914)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/wp_query-issuequestion/#post-2052372)
 * I am trying to generate links. So where it now says the_title(), it will later
   generate li tags, like so:
 *     ```
       while ($queryObject->have_posts()) {
       	$queryObject->the_post();
       	echo '<li><a href="'; the_permalink(); echo '">'; the_title(); echo '</a></li>';
       }
       ```
   
 * But for simplicity, I took that out. I was thinking keeping the post simple might
   make it easier to grasp. Sorry if I wasn’t clear, I guess it did the opposite.
 * Yes, I would like to show all the subpages of page 11. This is for a sub navigation
   only on pages of section 11.
 * Thanks a lot!
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/wp_query-issuequestion/#post-2052373)
 * [http://codex.wordpress.org/Function_Reference/WP_Query#Post_.26_Page_Parameters](http://codex.wordpress.org/Function_Reference/WP_Query#Post_.26_Page_Parameters)
 * > post_parent (int) – use page id. Return just the child Pages.
 * try to use the above parameter instead of ‘child_of’
 * withour checking, i went with the idea that ‘child_of’ should work ( as it does
   in `get_pages()` ), however, it does not seem to be a (valid) parameter of `wp_query()`

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘WP_Query issue/question?’ is closed to new replies.

## Tags

 * [array](https://wordpress.org/support/topic-tag/array/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [wp_query](https://wordpress.org/support/topic-tag/wp_query/)

 * 3 replies
 * 2 participants
 * Last reply from: [Michael](https://wordpress.org/support/users/alchymyth/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/wp_query-issuequestion/#post-2052373)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
