I created a template web page for a customized submit kind known as auctions-upcoming.php…
<?php
/**
* Template Title: Upcoming Auctions
*/
get_header();
$args = array(
'post_type' => 'public sale',
'meta_key' => 'date_time',
'orderby' => 'meta_value',
'meta_value' => date("Y-m-d h:i"),
'meta_compare' => '>=',
'order' => 'ASC',
'posts_per_page' => -1,
);
$my_query = new WP_Query($args);
$choices = get_option('auction_options');
?>
<!-- auctions-upcoming.php -->
<div class="container-fluid">
<div class="row">
<?php /* Begin the Loop */
whereas ($my_query->have_posts()) : $my_query->the_post(); $metadata = get_post_custom(get_the_ID()); ?>
<div class="col-12 col-sm-12 col-md-12 col-lg-6 col-xl-4 mb-4">
<div class="shadow">
<div id="post-<?php the_ID(); ?>" <?php post_class('single-post m-0 p-0'); ?>>
<div class="auction-card">
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(array(400,225), array('alt' => get_the_title(), 'class' => 'img-responsive h-auto mx-auto d-block')); ?>
<div class="overlay-text">
<h5><?php the_title(); ?></h5>
</div>
</a>
</div>
<div class="p-2">
<p>
<font coloration="#04B404">
<b>Public sale Info:</b>
</font>
<br />
Public sale Date: <b><?php echo date_format(date_create($metadata["date_time"][0]), "l, F j, g:i A"); ?></b><?php
if (!is_null($metadata["date_time_update"][0])) {
echo "<br />Final Up to date: <b>" . date_format(date_create($metadata["date_time_update"][0]), "F j, g:i A") . "</b>";
}
?>
</p>
<?php echo $metadata["location"][0] ? "<p><font coloration="#04B404"><b>Public sale Web site:</b></font><br />" . nl2br($metadata["location"][0]) . "</p>" : "";
the_excerpt(); ?>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
</div>
<?php //get_sidebar(); ?>
</div>
<?php
wp_reset_query();
get_footer();
The factors for the question returns the customized submit kind auctions, it is sorted in ascending order by the meta_value of the meta_key known as date_time, and the place the date_time worth is larger than the present year-month-day hour:minute.
Every public sale returned makes use of a single web page template known as single-auction.php to show the main points of every public sale…
<?php
/**
* The template for displaying single public sale
*/
get_header();
?><!-- single-auction.php -->
<div id="major" class="content-area row">
<div class="col-2"></div>
<most important id="most important" class="site-main col-8" position="most important">
<?php
// Begin the loop.
whereas ( have_posts() ) :
the_post();
// get content material
get_template_part( 'content material', 'public sale' );
// Earlier/subsequent submit navigation.
the_post_navigation(
array(
'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Subsequent', 'bpa' ) . '</span> ' . '<span class="screen-reader-text">' . __( 'Subsequent submit:', 'bpa' ) . '</span> ' . '<span class="post-title">%title</span>',
'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Earlier', 'bpa' ) . '</span> ' . '<span class="screen-reader-text">' . __( 'Earlier submit:', 'bpa' ) . '</span> ' . '<span class="post-title">%title</span>',
)
);
// Finish the loop.
endwhile;
?>
</most important>
<div class="col-2"></div>
</div>
<?php get_footer();
My downside is the_post_navigation operate returns the earlier or subsequent submit within the order it was entered into WordPress and never within the order of the meta_value of the date_time meta_key.
How do I make the_post_navigation operate within the single-auction.php template comply with the order established within the WP_Query on the auctions-upcoming.php template?
Indications are I want to make use of the get_{$adjoining}_post_sort hook, however I am nonetheless not sure the right way to implement it.