Wanting to add Random Oderby to Template
-
Hi im running the template called Adirondack
And i really like it, but i need to edit the template so it orders the front page/featured page randomly.
I have look at some of the code, but i can’t find it…
index.php:
get_header(); ?> <?php if ( is_front_page() && adirondack_has_featured_posts() ) { // Include the featured content template. get_template_part( 'featured-content' ); } ?> <div id="primary" class="content-area"> <main id="main" class="site-main" role="main"> <?php if ( have_posts() ) : ?> <?php /* Start the Loop */ ?> <?php while ( have_posts() ) : the_post(); ?> <?php /* Include the Post-Format-specific template for the content. * If you want to override this in a child theme, then include a file * called content-___.php (where ___ is the Post Format name) and that will be used instead. */ get_template_part( 'content', get_post_format() ); ?> <?php endwhile; ?> <?php adirondack_paging_nav(); ?> <?php else : ?> <?php get_template_part( 'content', 'none' ); ?> <?php endif; ?> </main><!-- #main --> </div><!-- #primary -->featured-content.php:
<?php /** * The template for displaying featured content * * @package Adirondack */ global $in_featured; $in_featured = true; ?> <div id="featured-content" class="featured-content"> <div class="featured-content-inner"> <?php $featured_posts = adirondack_get_featured_posts(); foreach ( (array) $featured_posts as $order => $post ) : setup_postdata( $post ); // Include the featured content template. get_template_part( 'content', 'featured-post' ); endforeach; wp_reset_postdata(); $in_featured = false; ?> </div><!-- .featured-content-inner --> </div><!-- #featured-content .featured-content -->
The topic ‘Wanting to add Random Oderby to Template’ is closed to new replies.