Sorting Output when showing child pages using
-
Here is the activities page on my website: https://www.hotribscooljazz.org/activities/
I have each activity as a child of the main activities landing page. The landing page template then grabs the content, truncates it, and creates a link for each of these child pages. That much works… BUT how do I control the order in which they appear??????? I’ve tried changing the “order” number and the “published on” dates in word press for each page… but this has not worked… Below is my code. Can anyone tell me how to edit this to give me the ability to sort my output… THANK YOU!!!!!
get_header(); ?> <div id="pageContent"> <table class="pageContentTable"> <tr class="spacing"> </tr> <tr class="regularRow"> <td class="sidebar" valign="top" > <div class="sidebar_wrapper"> <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('primary-sidebar') ) : ?> <?php endif; ?> </div> </td> <td class="main_page_content" valign="top"> <div id="ContentInset"> <!---Places Page Title----> <?php if (have_posts()) : while (have_posts()) : the_post();?> <h1><?php the_title(); ?></h1> <?php endwhile; endif; ?> <!---Places Page Content----> <?php if (have_posts()) : while (have_posts()) : the_post();?> <?php the_content(); ?> <?php endwhile; endif; ?> <?php $current_page = $post->ID; $querystr = " SELECT * from $wpdb->posts WHERE post_type = 'page' AND post_parent = $current_page "; $child_pages = $wpdb->get_results($querystr, OBJECT); if ($child_pages): foreach($child_pages as $post) : setup_postdata($post); ?> <table class="activityList"> <tr> <td class="activity_logo_cell"> <a href="<?php the_permalink();?>"><?php the_post_thumbnail('Activity_Logo_Small');?></a> </td> <td class="activity_content_cell"> <h2><?php the_title(); ?></h2> <?php $thecontent = $post->post_content; $getlength = mb_strlen($thecontent); $thelength = 350; echo substr(strip_tags($thecontent), 0, $thelength); if ($getlength > $thelength) echo "…"; ?> <a href="<?php the_permalink();?>"><?php _e('[Read More]');?></a> </td> </tr> </table> <h4></h4> <?php endforeach; ?> <?php else : ?> No additional information about activities is currently available. Check back soon! <?php endif; ?> <?php rewind_posts(); ?> </div> </td> </tr> </table> </div> </div> <!---Main Content Wrapper----> <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Sorting Output when showing child pages using’ is closed to new replies.