To sort by title in ascending order (alphabetical order), you can use orderby
=> title
and order
=> ASC
:
$args = array(
'post_type' => 'marketing_en',
'orderby' => 'title',
'order' => 'ASC',
'tax_query' => array(
array(
'taxonomy' => 'custom_post_type',
'field' => 'slug',
'terms' => array(ICL_LANGUAGE_CODE == 'ar' ? 'tool-ar' : 'tool'),
),
),
);
$loop = new WP_Query($args);
while ( $loop->have_posts() ) : $loop->the_post();
Make sure you have the correct values in the post_type
and taxonomy
fields. The value of post_type
should be the custom post type you are querying and the taxonomy should be the correct taxonomy associated with your posts.
Related Posts:
- Ignoring initial articles (like ‘a’, ‘an’ or ‘the’) when sorting queries?
- Sorting: custom query with orderby meta_value_num THEN by title
- Sort posts by category name and title
- How to get order of posts?
- How to get Page/Post Gallery attachment images in order they are set in backend using WP_Query()?
- WP Query orderby meta key natural sort?
- Loop through all tags & output posts in alphabetical list
- Sorting Posts by custom field
- Sorting meta_value as integer doesn’t work
- Sort in WP_Query(), not filter? Is it possible?
- Front End Sorting Questions
- Woocommerce custom loop to show all the products [closed]
- Sort by meta key on archive page
- How to sort posts in admin by titles with dd.mm.yyyy format?
- Query Set Order By Author
- WordPress: Keep order of query_posts list of post ID’s using post__in
- How to make orderby ‘meta_value_num’ OPTIONAL?
- Meta query with order by another custom field
- How to orderby meta_value_num with dollar ($) sign
- How do I sort posts with multiple pages
- WP_Query posts by distance based on LAT & LNG in Database
- Changing WP_Query params with url Query Var
- Sort wordpress custom posts based on meta value
- WP_Query: Group events by year, sorted DESC; then by date for each year group, sorted ASC
- WordPress Comments sort by custom meta key
- Understanding the orderby in WP_Query?
- WP_query sorting can’t sort danish letters (æ, ø, å)
- Help ordering Post loop by two meta values
- How to sort a custom wordpress query by combination of meta values?
- Gallery shortcode numerical sorting
- WP Group posts by year(desc) > month(desc) > date(asc)
- Does wp track views for posts?
- Sort WordPress Posts Meta value by Week not Day
- How to order WP_Query to group results?
- I am having problem sorting custom post type using WP_Query
- Sorting search results with custom dropdown
- How to use a dropdown to filter posts by custom field
- Display all posts in a custom post type, grouped by a custom taxonomy. How to sort the posts alphabetically and the terms by ID?
- How do I sort this custom list of sticky posts
- WP Query and date format
- How to sort queried pages by an array of page ids?
- orderby ignored by wp_query
- Customize the Sorting Dropdown in WooCommerce use another list or more page
- Order (by ASC) posts with meta_key so posts without values are last
- How to sort store location by specific category order in WP store locations
- how to include orderby value that is empty?
- How to sort wordpress posts already selected by WP_QUERY
- Sort by price wpdb
- Custom Woocommerce Product Query
- How sort products by calculate value? ( custom post meta, price, option)
- Get authors list and sort them by recent posts
- Move some posts to end of sort order, even if there is a sort in the wp_Query already
- Order by value of Custom Field using url string
- WP Query with meta queries
- Order 2 meta_queries differently in WP_Query?
- Case insensitive ORDERBY in wpquery
- Sort posts on custom field AND after that sort on date?
- How to mix two orderby-parameters into one ordered result
- Sorting Posts by Taxonomy thats not within the query’s $args
- Ignoring ‘a’ when sorting posts
- Display three sequential posts on each page load, without repeating previous
- Combine WP_Query with array of custom data to single loop without breaking the pagination
- Wrap group of wp query posts to parent div by date/year
- Sorting posts by meta values: 2 different orders
- Sorting is not working in WordPress WP_Query
- How to sort a WP_Query array by post_name after an array_merge();
- Sorting: custom query with orderby meta_value_num THEN by title
- query_posts with sorting on a custom datestamp
- Sort Posts with custom meta key by default which is currently set as optional
- wordpress sorting using array merge by price in ascending order but price with 0 must be show last
- have_posts order by title descending
- WP_Query – order with usort by custom meta
- Sort by multiple columns using get_posts
- How to use the_posts_navigation for wp_query and get_posts?
- Sorting a query by custom field date
- Single page theme that uses pages for the content
- wp_transients | wp_object_cache VS SESSIONS & Cookies?
- How to hide post content/meta from everyone except the post author and admin
- When querying a combination of posts and other meta fields, is there a better solution than directly modifying the WHERE value?
- How to reduce the number of queries?
- Return Taxonomy/Term Information with Posts (WP_Query/get_posts)
- Wp_query: sort by PHP variable
- Use posts_groupby filter with part of string in wp_query?
- WordPress Blog Posts with Pagination inside a Page/Post
- Limit home post to 10 without creating pagination?
- WP_Query Meta_key is text value and need to sort as numeric not working
- Create a page template for “top rated posts” but show full content and not just a list
- Why tax_query in WP_Query not working
- How can I detect if the current post is in this loop?
- wpquery via ajax
- Where is this query?
- Why does my output of get_the_ID() change after a wp_query?
- WP Query works outside a function, not inside a function
- Pull posts from all categories if quantity is not met?
- Multiple tax_queries: display posts titles from several custom taxonomie
- How to query images from a post to use in a slider
- Pagination not working in some author pages
- qTranslate get content by language using wp_query
- Custom search: Search posts but display parent page in results
- Pagination with Custom Post Type not working on index.php: I get a 404