• Resolved ArielZusya

    (@arielzusya)


    Looking for some assistance in executing a query and returning the results of that query. What I’m looking for is to return the permalinks for pages which have page 306 as their parent. If I run this query in mysql it returns precisely what I’m looking for… but I just don’t know wordpress well enough to know how to do it in WP. I’ve tried, with no success, this:

    <?php
    
    	// The Query
    	$the_query = new WP_Query( 'post_parent=306 AND post_type="page"' );
    
    	// The Loop
    	while ( $the_query->have_posts() ) : $the_query->the_post();
    		echo '<li>';
    		echo '<a href="' . the_permalink() . '" title="' . the_title() . '">' . the_title() . '</a>';
    		echo '</li>';
    	endwhile;
    
    	// Reset Post Data
    	wp_reset_postdata();
    
    ?>


    What am I doing wrong? Thanks for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ArielZusya

    (@arielzusya)

    Incidentally, I’ve also tried using:


    <?php wp_list_pages('title_li=&child_of=306&depth=1'); ?>

    but I don’t want the list to show up as a list (using <li> tags). I just want the links. If there’s a way to use wp_lists_pages and get what I’m looking for, I’d be happy with that as well. Thanks!

    Thread Starter ArielZusya

    (@arielzusya)

    I was able to solve my issue… I just wrapped the wp_list_pages in a div that stripped off the list bullet. The div tag looks like this:
    <div style="list-style:none;line-height: 2em;">

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘return list of children’ is closed to new replies.