• Hi. I’ve paid someone to set up my website using WordPress, but he’s not answering my emails. The guy has created a page template which automatically adds and sorts other pages. However, they’re sorting alphabetically and I’d like to be able to sort them by date/time created. The code for the page template is below. Any help would be greatly appreciated. Cheers.

    <?php
    /*Template Name:Collections*/
    get_header();
    ?>
    <div class="container protfolio-page left-space">
    	<div class="row">
    		<div class="col-sm-12">
    			<h4 class="section-title"><?php the_title(); ?></h4>
    		</div>
    	</div>
    	<div class="row">
    		<div class="col-sm-12 projects-intro">
    			<h1><?php the_field("page_heading"); ?></h1>
    			<h4><?php the_field("page_sub_heading"); ?></h4>
    		</div>
    	</div>
    
    	<?php
    		$args = array(
    			'post_type' => 'page',
    			'post_status' => 'publish',
    			'meta_key' => '_wp_page_template',
    			'meta_value' => 'template-home-art.php'
    		);
    	$pages = get_pages($args);
    
    	foreach($pages as $page){
    		if($page->post_title != 'Home'){
    			?>
    			<div class="col-sm-6 nlp collection no-float">
    				<a>ID); ?>"><div class="collection-cover"><?php echo get_the_post_thumbnail($page->ID, 'full'); ?></div></a>
    				<h4><?php echo $page->post_title; ?></h4>
    				<p><?php $description = get_post_meta($page->ID, 'collection_description'); echo $description[0]; ?></p>
    			</div>
    
    			<?php
    		}
    	}
    
    	?>
    
    </div>
    
    <script type="text/javascript">
        jQuery(document).ready(function($){
            $(".filterable").mixitup({
                targetSelector : "div.project_block",
                filterLogic : "and",
                multiFilter : true
            });
        });
        project_page = 1;
    </script>
    <?php get_footer(); ?>

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Sort items within a page’ is closed to new replies.