Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.