WordPress.org

Ready to get started?Download WordPress

Forums

Post Types Order
[resolved] Previous / Next Navigation - Wrong order (7 posts)

  1. sebchauss
    Member
    Posted 2 years ago #

    Versions :
    WP 3.3.2
    Advanced Post Types Order 2.5.0.3.1

    Problem :
    The posts I get from the get_adjacent_post() function in single.php don't respect the order defined with your plugin if "Auto Sort" is defined on "ON/Custom". But it's ok with "Auto Sort" defined on "ON".

    http://wordpress.org/extend/plugins/post-types-order/

  2. sebchauss
    Member
    Posted 2 years ago #

    Sorry, I gave the wrong versions. Here are the right ones :

    Versions :
    WP 3.3.2
    Advanced Post Types Order 2.5.0.5

  3. nsp-code
    Member
    Plugin Author

    Posted 2 years ago #

    This is an expected behavior under the ON/Custom AutoSort Option. Only when AutoSort is turned ON the next/previous links are updated.

    In this case you will need to use the previous_post_type_link and next_post_type_link functions which should replace the default previous_post_link and next_post_link

    Usage example:
    previous_post_type_link( '%link', __( '<span class="meta-nav">←</span> Previous', 'twentyeleven' ), FALSE, '14', 'category' );

    where the arguments are 
    $format, $link, $ignore_custom_order, $term_id, $taxonomy_name
     

  4. sebchauss
    Member
    Posted 2 years ago #

    Ok but what I need are the posts :

    $nextPost = get_adjacent_post(false,'',false);
    $prevPost = get_adjacent_post(false,'',true);

    And it doesn't work with it.

  5. nsp-code
    Member
    Plugin Author

    Posted 2 years ago #

    To retrieve the post data you can use the following:

    apto_get_adjacent_post ($ignore_custom_sort, $term_id = '', $taxonomy = '', $previous)

    The $previous require a Boolean variable, TRUE if you need previous post or FALSE for next.

    The function is relative to the default query $post variable content, so if you need to use it along with a custom query, make sure you use a new WP_Query call.http://codex.wordpress.org/Class_Reference/WP_Query

  6. sebchauss
    Member
    Posted 2 years ago #

    That seems ok even if the order is weird if you haven't clicked yet on the "update" button in the "re-order" screen.

    Thank you.

  7. tdgu
    Member
    Posted 2 years ago #

    This may return different results that the default get_adjacent_post since the apto_get_adjacent_post can return next/previous for a term objects list instead. So this is an expected result, unless you need to use the archive as reference in which case you may want to use the default get_adjacent_post or use empty params for the apto_get_adjacent_post

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.