WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] single.php next and previous in alphabetizing sort (4 posts)

  1. jaiunblog
    Member
    Posted 6 years ago #

    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 ?

  2. Kafkaesqui

    Posted 6 years ago #

    http://wordpress.org/support/topic/87573#post-454996

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

  3. jaiunblog
    Member
    Posted 6 years ago #

    perfect !

  4. jaiunblog
    Member
    Posted 6 years ago #

    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";

Topic Closed

This topic has been closed to new replies.

About this Topic