Create custom post order (with custom post type meta)

Save your data in a single field as either YYYY-MM-DD or UNIXTIME. Then query like this: $args = array( ‘post_type’ => ‘POST_TYPE_NAME’, ‘meta_key’ => ‘date-key-name’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ); $query = new WP_Query( $args ); You should get an order, unless I am having a bad morning, of Day -> Month -> … Read more

single post navigation order (NOT chronological)

after a lot of trial and error WP transients came to save me!! here is the solution for anyone that might need this… in the index.php (outside the main loop) i save the current random order in a transient: $order_array = array(); while ( $the_query->have_posts() ) : $the_query->the_post(); $order_array[] = get_the_ID() ; endwhile; set_transient(‘post_order’, $order_array, … Read more

Order by custom field in query multiple

You need ‘order_by’ => ‘post__in’ in the last query in order to “Preserve post ID order given in the post__in array (available with Version 3.5).”. I don’t know if the order you are passing in is the order you want after the array_merge( $group_1, $group_2). In other words, you need to feed that second query … Read more

Ordering Subcategories

I have never used the plugin you found but it looks pretty heavy, at least on the backend, and may be overkill unless you need a lot more functionality than described in the question. get_categories operates from cached data so my thought was to simple alter the returned array rather than perform another query or … Read more

Posts2Posts, wp_query and orderby issue

I don’t have any experience with posts2posts, but to see the query that wp_query runs on your database, before your if statement, put echo $new_connected->request. Helped me a lot to debug wp_query when I couldn’t find out which parameters weren’t working. The output is the SQL query that will be performed on the DB. Therefor … Read more

Echo order box (in pages)

First you need to get the value from attributes, option page or meta value; if you have an option page you need to call that value: $valuerequired = get_option(‘ctech_valuefromoptionpage’); ctech is the short theme name, and if the attributes field is a meta value $price = get_post_meta($post->ID, ‘price’, true); then you can echo the value … Read more

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