Ordering projects by title
-
I am attempting to use projects as an additional form of simple post to create a glossary. I’m trying not to mix the Glossary posts with normal Blog Posts.
This all works fine, except I can’t seem to influence the ORDER of my project posts on the Glossary page when adding code to my functions.php. I have tried various permutations of the following:
//SORT PROJECTS BY TITLE add_action( 'pre_get_posts', 'sort_by_title'); function sort_by_title($query){ //target the glossary page if (get_the_ID() !=1523) return; //$query-> set('post_type' ,'project'); $query->set( 'orderby', 'title' ); $query->set( 'order', 'ASC' ); };
The impresssion I have is that posts, pages and projects are all generic types of ‘post’, but I must be missing something.
I will be very grateful for any help.
Thank you
DavidThe page I need help with: [log in to see the link]
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Ordering projects by title’ is closed to new replies.