Tag Info

Hot answers tagged

2

It goes to the page, but I can't figure out how to modify my loop so it only shows posts that match the current term, in this example "element", nor display the title of the page as "Element". The following arguments for your loop should do: $args = array( 'post_type' => 'design_asset', 'posts_per_page' => 100, 'orderby' => ...


2

You could also use the posts_orderby filter: function wpse155827_posts_orderby_price( $orderby ) { return str_replace( 'wp_postmeta.meta_value', 'substr(wp_postmeta.meta_value, 1)', $orderby ); } add_filter( 'posts_orderby', 'wpse155827_posts_orderby_price' ); $theQuery = new WP_Query( array( 'orderby' => 'meta_value_num', 'meta_key' => ...


2

Your actual question is basically when to run a custom query and when to make use of the main query. Lets break it down in three parts PART ONE When to run a custom query (This is not a definitive list) To create custom content sliders To create a featured content area in a page On page.php templates if you need to display posts If you require custom ...


1

The requires are just echoing the content, you need to put ob_start(); before the if ($query->have_posts()) :, and return ob_get_clean(); after the endif;.


1

You basically have the answer, just add $date2 to the inner sql where clause: AND p.post_date > '$date2' to get last week. To get a particular week, use AND p.post_date < '$date1' AND p.post_date > '$date2' where eg $date1 = date('Y-m-d', strtotime('2014-07-04 +1 days')); $date2 = date('Y-m-d', strtotime('2014-07-04 -8 days')); To return ...


1

Steve, you've asked a couple of questions which I had a look at, and I came to the conclusion that your loop is causing all of your headaches. My loop to display ALL the posts is: $args = array( 'post_type' => 'design_asset', 'posts_per_page' => 100, 'orderby' => 'title', 'order' => 'ASC' ); $loop = new WP_Query( $args ); while ( ...



Only top voted, non community-wiki answers of a minimum length are eligible