Changing WordPress sort order for returned child pages
This query should work. $images = new WP_Query( array( ‘post_type’ => ‘menu-item’, ‘post_parent’ => $this_page_id, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ ) );
This query should work. $images = new WP_Query( array( ‘post_type’ => ‘menu-item’, ‘post_parent’ => $this_page_id, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ ) );
I noticed you have an extra quote after order in your args. That affecting it?
If you can stand to not have it be backwards compatible, CSS3 introduced the nth-child selector, you could leverage that
I would do something like this: <script type=”text/javascript”> //http://www.netlobo.com/url_query_string_javascript.html function gup( name, default_value ) { name = name.replace(/[\[]/,”\\\[“).replace(/[\]]/,”\\\]”); var regexS = “[\\?&]”+name+”=([^&#]*)”; var regex = new RegExp( regexS ); var results = regex.exec( window.location.href ); if( results == null ) return default_value; else return results[1]; } //here you can output default values for sortby and … Read more
Three loops http://codex.wordpress.org/Class_Reference/WP_Query#Time_Parameters $time = time(); foreach ( range( 0, 2 ) as $yesterday ): // get relative time offset by $yesterday days $rel_time = strtotime( “-$yesterday days”, $time ); // get the digits $year = date( ‘Y’, $rel_time ); $day = date( ‘d’, $rel_time ); $month = date( ‘m’, $rel_time ); // get the … Read more
It seems the problem is solved by adding ‘posts_per_page’ => -1 which forces WordPress to show all posts matching the parameters. Here’s my final code: array ( ‘post_type’ => ‘symposia_program’, ‘days’ => $progDay, ‘meta_key’ => ‘class_number’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1 );
Have you tried this plugin : WP Most Popular ? You can display popular posts from the last day, 7 days, 30 days or all time. From the “Other notes” page : Usage There are two ways in which you can use this plugin. As a sidebar widget Custom function in your theme files Using … Read more
i assume its exclusive to either sort by title $_GET[‘sort_title’] OR sort by custom field ( but not necessarily) and you that you pass $_GET[‘sort_price’]. if neither are present, “title” is default. with that in mind, check both values if( isset($_GET[‘sort_title’]) ) { $sort_by = $_GET[‘sort_title’]; //orderby can accept multiple values } elseif ( isset($_GET[‘sort_price’]) … Read more
In order to accomplish what you desire, you’ll have to fetch the posts ahead of time. There is no way to specify in SQL an arbitrary ordering given an ID list. query_posts() creates another main query, throwing out the main query. Since you’re doing this anyway, you can use get_posts() to return a list of … Read more
Short of building it yourself, you don’t. WordPress doesn’t have a way to get a nested array of comments like that. Instead, it gets all the comments to be displayed, then uses a class called a “walker” to display them. The Walker_Comment class is built on top of the generic Walker class. The Walker class … Read more