$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>previous next with custom-post-type by order attribute|Concepts Of Algorithm

previous next with custom-post-type by order attribute

admin2025-01-07  8

I have a custom-post-type called 'artists'. I list them by the order attribute (menu_order).

$args = array(
    'post_status' => 'publish',
    'post_type'   => array('artists),
    'orderby'=> array('menu_order'=>'ASC' ),
);
$wp_query = new WP_Query( $args );

When I use the_post_navigation() to get the previous and next links, it takes the date as the order instead of the menu_order. How can I get it to work right in this case?

I have a custom-post-type called 'artists'. I list them by the order attribute (menu_order).

$args = array(
    'post_status' => 'publish',
    'post_type'   => array('artists),
    'orderby'=> array('menu_order'=>'ASC' ),
);
$wp_query = new WP_Query( $args );

When I use the_post_navigation() to get the previous and next links, it takes the date as the order instead of the menu_order. How can I get it to work right in this case?

Share Improve this question asked Aug 4, 2015 at 2:33 waterschaatswaterschaats 1501 silver badge8 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Maybe this function is better to use get_adjacent_post.

I have not tested it yet but it seems to more flexible than the_post_navigation() function.

FYI, the_post_navigation() uses this function internally to retrieve the next and previous posts.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1736262271a805.html

最新回复(0)