inner foreach loop sorting

It looks like all you need to do is change toe orderby argument of your wp_get_object_terms() call. After all, that’s what you’re looping through further down. If you change ‘orderby’ => ‘ID’ to ‘orderby’ => ‘name’, your terms will be ordered alphabetically.

sort items by randomness

You need a custom query. codex ref For instance, $args = array( ‘orderby’ => ‘rand’, ‘posts_per_page’ => 20, ); $query = new WP_Query( $args ); this query pick 20 random items. If you go above link, you can see more examples. I hope this will help you.

How to sort by number

You are using pre 4.5.0 code which will eventually be depricated. Try this. $productTerms = get_terms( array( ‘taxonomy’ => ‘prezzoceste’, ‘hide_empty’ => false, ‘orderby’ => ‘ASC’, ‘meta_key’ => ‘_price’, //The price Meta Key ‘orderby’ => ‘meta_value_num’, ) ); Check this for more accepted arguments.

‘sort_column’ => ‘menu_order’ not working

When the child_of parameter is set, get_pages() will use get_page_children() to get the child pages, and unfortunately, the sort_column will no longer be used, hence the final list will not be sorted by the specified custom sort column, so you’ll need to use your own code for getting the list with the expected sort column … Read more

How to avoid duplicating same meta_value?

One way would be to keep track of which years you’ve already printed. Using your code: <?php $args = array( ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘numberposts’ => -1, ‘orderby’ => ‘menu_order’, ‘order’ => ASC ); $attachments = get_posts( $args ); echo ‘<table id=”bibliography”>’; if ( $attachments ) { $already_printed_years = array(); foreach ( $attachments … Read more

Sorting posts by custom field value

Your date should be stored in descending units, like yyyy-mm-dd hh:mm:ss for MySQL to be able to sort on the field. See the MySQL docs for Date, Datetime, and Timestamp data types.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)