WordPress.org

Forums

[resolved] rel=next order with menu_order (2 posts)

  1. victor_d
    Member
    Posted 3 years ago #

    Hi!
    i'm trying to sort the rel=next/prev links like the page menu Hierarchy
    with the menu_order function.
    so i tried to hack the links-template.php at line 1100
    changing
    orig:

    $adjacent = $previous ? 'previous' : 'next';
    	$op = $previous ? '<' : '>';
    	$order = $previous ? 'DESC' : 'ASC';
    
    	$join  = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_cat, $excluded_categories );
    	$where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_cat, $excluded_categories );
    	$sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );

    to
    new

    $adjacent = $previous ? 'previous' : 'next';
    	$op = $previous ? '<' : '>';
    	$order = $previous ? 'DESC' : 'ASC';
    
    	$join  = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_cat, $excluded_categories );
    	$where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.menu_order $op '1' AND p.post_type = 'page' AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_cat, $excluded_categories );
    	$sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY menu_order ASC LIMIT 1" );

    now it gives me the page with menu_order id 1 not the next id.

    i would be glad if someone knows an answer!

    Thanks
    Victor

  2. victor_d
    Member
    Posted 3 years ago #

    i would delete this topic if i could...

    i'll ask more precisely in another and more eligible forum.

Topic Closed

This topic has been closed to new replies.

About this Topic