WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] subpage in sidebar showing up unexpectedly (1 post)

  1. firehouse
    Member
    Posted 7 years ago #

    Look at http://www.getsalesresultsnow.com click on Why Chuck, you will see the See Also section (subpages) listed on the sidebar, but then click on FAQ's, this is a page, it has no subpage(children), but The See Also image shows up in the sidebar where the subpages would be listed, now, mind you there is not a link to a subpage, but I dont want the "See Also" image to show up when there are not any subpages (children) for that page. How do I go about getting the image to be conditional as well as the links etc.? Here is my code.Any help would be appreciated.

    <?php global $notfound; ?>
     <?php /* Creates a menu for pages beneath the level of the current page */
      if (is_page() and ($notfound != '1')) {
       $current_page = $post->ID;
       while($current_page) {
        $page_query = $wpdb->get_row("SELECT ID, post_title, post_status, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
        $current_page = $page_query->post_parent;
       }
       $parent_id = $page_query->ID;
       $parent_title = $page_query->post_title;
    
    if ($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id' AND post_status != 'attachment'")) { ?>
    
    <div class="sb-pagemenu">
    
    <img src="http://www.getsalesresultsnow.com/siteimages/see_also.jpg" alt="Related Pages" title="Related Pages"  />
    
    <ul><?php wp_list_pages('sort_column=menu_order&title_li=&child_of='. $parent_id); ?></ul>
    
        <?php if ($parent_id != $post->ID) { ?>
         <a href="<?php echo get_permalink($parent_id); ?>"><br /><b><?php printf(__('-> Back to %s'), $parent_title ) ?></b></a>
        <?php } ?>
       </div>
     <?php } } ?>
    
     <?php if (is_attachment()) { ?>
      <div class="sb-pagemenu">
       <a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment">
     <?php printf(__('Back to \'%s\''), get_the_title($post->post_parent) ) ?></a>
      </div>
    <br/>
    
     <?php } ?>

Topic Closed

This topic has been closed to new replies.

About this Topic