Viewing 1 replies (of 1 total)
  • Thread Starter jiggaman

    (@jiggaman)

    In the file:

    I added the following to the supports array: ‘page-attributes’

    Now users will see an “order by” field in an attributes box.

    To use this field, one must then create a archive template in their theme called archive-fancy-gallery.php

    Then in that file have the following code, best of luck:

    <?php
    /**
     * The template for displaying Archive pages.
     *
     * Learn more: http://codex.ww.wp.xz.cn/Template_Hierarchy
     *
     * @package YOURTHEMNAME
     */
    
    get_header(); ?>
            <div id="primary" class="col-md-12 <?php //echo esc_attr( of_get_option('blog_sidebar_pos') ) ?>">
                    <div id="content" class="site-content" role="main">
    
                    <?php if ( have_posts() ) : ?>
                            <?php /* Start the Loop */
                            $count_portf = 0;
    
                            ?>
                            <div class="row">
                            <?PHP $posts = query_posts($query_string . '&orderby=menu_order&order=asc&posts_per_page=-1'); ?>
                            <?php while (have_posts()) : the_post();
    
                                    // The following determines what the post format is and shows the correct file accordingly
                                    echo "<div class='col-md-4'>";
                                    $format = get_post_format();
                                    //get_template_part( 'post-formats/'.$format );
                                    //if($format == '')
                                    //get_template_part('post-formats/standard');//get_template_part( 'post-formats/standard' );
                                    echo "<figure class='featured-thumbnail thumbnail'><a href='" . get_post_permalink() . "' title='";
                                    echo get_the_title();
                                    echo "'>";
                                    echo get_the_post_thumbnail($page->ID, array(350, 285));
                                    //echo "<figure class='featured-thumbnail thumbnail'>" . get_the_post_thumbnail($page->ID, 'thumbnail') . "</figure>";
                                    echo "</a></figure>";
                                    echo "<header class='post-header'>
                                            <h3 class='post-title'><a href='" . get_post_permalink() .  "' title='" . get_the_title() . "'>" . get_the_title() . "</a></h3>
    
                                    </header>";
                                    echo "</div>";
    
                                    $count_portf++;
                                    $portf_num = $count_portf % 3;
                                    if ( 0 == $portf_num ) {
                                            ?>
                                            <div class="clear"></div>
                                            <?php
                                    }
                            endwhile; ?>
                            </div>
                    <?php else : ?>
    
                            <?php get_template_part( 'no', 'results' ); ?>
    
                    <?php endif; ?>
                    <?php get_template_part('post-formats/post-nav'); ?>
                    </div><!-- #content -->
            </div><!-- #primary -->
    
    <?php //get_sidebar(); ?>
    <?php get_footer(); ?>
Viewing 1 replies (of 1 total)

The topic ‘Ordering Field’ is closed to new replies.