It might be easier if you rearranged how you’re going about this. Rather than putting a numerical value for the title, why not put it as a custom field. You can still show all your posts and orderby your custom field as a numerical value using meta_value_num
. More info.
Here’s a topic on the WordPress Support forums for someone trying to accomplish the same thing: http://wordpress.org/support/topic/orderby-title-doesnt-sort-numbers-correctly?replies=38
Please note what user esmi says:
Can I point out that:
[…]
correct from a programming pov? Those “numbers” are actually strings –
not numeric integers.
PS — echo '<h1>$'. $ammount . '</h3>';
should be echo '<h1>$'. $ammount . '</h1>';
Related Posts:
- Only get_posts of certain post formats
- Is the first item returned by get_posts() always the latest post?
- Why can I not use setup_postdata($post) in the sidebar?
- Display sorting options dropdown when using WooCommerce product category shortcode
- How to retrieve a value from get_posts()? [closed]
- Drop down+sort blog posts date added/most popular
- What is the most efficient way to search users by their display name?
- Archive listing of posts by publish year (multiple years)
- Getting movie and serial on actor page
- how to display active, upcoming and past event with featured listing with pagination
- Display 4 chronological posts starting with a random post
- Sortable admin column for one meta key with three possible meta values
- How do I output a database option that is an array into a get_posts array?
- list posts and wrap them alphabetically A-Z
- Advanced Custom Fields: Post Object – Not returning data [closed]
- Order posts randomly, not by date
- Nesting if statements to echo only one string based on what tag was filtered?
- Why not yield/iterable in posts interface?
- Sort posts by custom fields value using dropdown menu
- How to Sort posts by Vote Count?
- Logged in user ID as post ID
- Sort query_posts for Parent Pages to menue order or the count?
- How to sort posts based on the value (number) of a post’s metadata?
- Sort custom meta column by other meta value
- Sort the result of the main Query in shop page by a custom taxonomy
- How do I exclude recent post from recent post php widget
- Open post-content in archive page in a Modal box with bootstrap
- get_posts() and WP_query limits ‘AND’ conditions to a maximum of 6 for meta value queries in WordPress
- Query if audio attachment AND/OR custom field
- How do I get post attachments in menu_order in WordPress?
- Sort by page information by Ascending Numbers
- PHP Syntax Error on get_posts
- How i can get post data from database when i am getting post id from url in wordpress
- How to retrive the text : No movie by this actor
- How to keep track of when a vote is cast?
- change the default order of posts only for specific categories
- How to get image from url from the database?
- Order BY Most Liked And Published Between Previous Week Monday And Next Week Monday
- How to tag the main tag? [closed]
- Removing custom sort order from admin page listing
- Unable to render custom field after attempt to generate a list of recent post in page template
- Add class to every other posts using get_posts
- search.php to search only the post title
- How to get woocommerce orders with get_posts method in a shortcode
- get value from get_post_meta then reuse it in another get_post_meta
- WordPress sorting posts by date and title using a dropdown
- Foreach Loop Of Post Types With Nested If Else If Not Completing Process
- How can I render more than multiple posts on template-parts with post formats
- How to sort (orderby) a query done by a template function before the ‘foreach’ loop?
- How to display post_content from database in different on template page?
- Displaying POST content with HTML tags and all
- Array sorting assistance
- Create a hierarchical loop at predefined markup requirements
- offset and max_num_pages in pagination gallery
- Even with PHP plugin get_posts not working in widget area
- Page 2+ of taxonomy archives does not recognise sort-order from dropdown
- Query category-specific, paginated posts and allow viewer to change sort order
- WordPress – show all posts + ones with specific tag
- Transient Loop Not working as expected
- show/hide attachments
- ISOTOPE – Missing/Invalid Arguement Get Terms
- Posts sortable column not sorting properly for custom field numbers
- category & sub category order issues in wordpress
- Sort author list alphabetically
- Find owner of coupon
- Link on post title only if post have content
- What is wrong with my sorting logic?
- How to make posts_like_dislike reference current post when iterating?
- Category Attachment Pagination 404 Error on 2nd Page
- how to make jpg downdable in wordpress?
- ::before on open/close function [closed]
- Tell WP register script to load a script only when the entire page is loaded
- Adding string before php [closed]
- Add Ajax Hooks and Call from Custom Template PHP
- How to style one item from main navigation?
- Reduce size of responsive title
- Moving wordpress site from localhost to live server using GoDaddy cPanel
- Function works everywhere, how to keep it to execute when creating a new post
- Making (and edit existing) posts with ID included
- WordPress ajax-action failing because of newline in response
- anyway to put inside a $outprint=sprintf()
- How can I import an excel column into wordpress database?
- REQUIRED: get_bloginfo(‘template_url’) was found in the file search.php. Use get_template_directory_uri() instead
- get_template_directory_uri() providing wrong path for img
- Making an AJAX call to refresh a table
- How does WP work in conjunction with a web server?
- How to use if statement in an array? [closed]
- Custom Pagination is Broken
- Display an image if odd number of posts in grid
- How to check if a PHP string is different than meta field?
- Can’t save php string to a custom field
- HTML escaping data with ajax requests
- add_filter only for front office
- WordPress comment submit button substitutes/options
- Blob file download problem
- How to make container class in PHP
- Using and saving custom dropdown boxes on user profiles
- Copy taxonomy terms from one post to another programmatically
- Error using WordPress $wpdb object to get result from custom table
- How to loop through all the attached images in a post, and get their url one by one