WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a landing page that pulls in an excerpt, title and thumbnail of its children. It works, except the title (which is the page title) link is doubling up the parent folder in the url it creates. like this: www.site.com/restaurant/restaurant/mcdonalds. I'm not great at PHP and I can't figure out why it's doubling on the title and not the thumbnail. How can i alter this to only pull in the parent once?

  if ( is_page( 'restaurants' ) ) {
                    $pageChildren = get_pages( array( 'child_of' => $post->ID, 'sort_column' => 'menu_order', 'hierarchical' => '0', 'exclude' => '1453' ) );
                    if ( $pageChildren ) {
                    foreach ( $pageChildren as $pageChild ) {
                    echo '<div class="restaurant-landing"><h2><a href="' . get_page_uri($pageChild) .'">' . $pageChild->post_title . get_the_post_thumbnail($pageChild->ID).'</a></h2>';
                    if ($pageChild->post_excerpt){
                    echo '<p>'.$pageChild->post_excerpt.'</p></div>';
share|improve this question
up vote 1 down vote accepted

if you look into the html in the browser, you should see that the function is outputting a relative link uri;

is there any reason why you are trying to use get_page_uri() instead of get_permalink() ?

share|improve this answer
you know what.. you're right. I don't know. that totally worked. :) Thank you! – jamie Oct 29 '12 at 22:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.