WordPress.org

Support

Support » Plugins and Hacks » [Resolved] single.php next and previous in alphabetizing sort

[Resolved] single.php next and previous in alphabetizing sort

  • Hi,

    I know how to sort post by alphabetizing title in the loop but how to have next and previous post buttons in single post view not sort by ID or Date ?

    I try
    $sort = apply_filters( 'get_previous_post_sort', 'ORDER BY p.post_title DESC LIMIT 1' );
    in link-template.php

    Any idea ?

Viewing 3 replies - 1 through 3 (of 3 total)
  • http://wordpress.org/support/topic/87573#post-454996

    Give me about a day or so to update it for 2.3.x support.

    perfect !

    here a adaptation for my project (a base)
    title sort only for cat id 3…
    $select is the old
    $my_select is for wp 3.2.x 😉

    $select="SELECT ID,post_title
    FROM $wpdb->posts $join
    WHERE post_status = 'publish' $post_type
    AND TRIM(post_title) $gt_lt '" . addslashes(trim($post->post_title)) . "' $sqlcat $sql_exclude_cats
    AND ID != $post->ID
    ORDER BY TRIM(post_title) $asc_desc
    LIMIT 1";
    $my_select="SELECT * FROM $wpdb->posts LEFT JOIN $wpdb->postmeta ON($wpdb->posts.ID = $wpdb->postmeta.post_id) LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) WHERE $wpdb->term_taxonomy.term_id =3 AND $wpdb->term_taxonomy.taxonomy = 'category'
    AND $wpdb->posts.post_status = 'publish'
    AND ID != $post->ID
    ORDER BY $wpdb->posts.post_title  $asc_desc LIMIT 1";

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] single.php next and previous in alphabetizing sort’ is closed to new replies.