• Here is the activities page on my website: http://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 "&hellip;";
                                        ?>
                                        <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)
  • What if you did not use child pages (assuming you are not referring to page templates) and created a custom menu? Then, the sort order of ‘order’ should work (although the default filter is id)..also, if a child page uses a differing page template than it’s parent, this can cause issues (especially if one changes the page template or removes it from a parent page)…for each group of parent and child pages use same page template or least make them use same functions.

    Thread Starter KACramer

    (@kacramer)

    Ummm… yeah… no clue what your saying but thanks anyway… I am not a programmer… I know enough code to be dangerous. Beside why would I create a custom menu anyway? That wouldn’t do what I want the page to do… the entire point is to have subpages for each activity…

    Can anyone answer the actual question I asked? Vague confusing answers are useless for me… I don’t have the time. Not trying to be rude here… but I need specific answers.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Sorting Output when showing child pages using’ is closed to new replies.