query_post problem
// Category should be ‘cat’ <?php $args = array( ‘cat’ => $cat, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘blog’, ‘post_status’ => ‘publish’ ); ?>
// Category should be ‘cat’ <?php $args = array( ‘cat’ => $cat, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => ‘blog’, ‘post_status’ => ‘publish’ ); ?>
I found the issue, I shouldn’t have been trying to filter on post_content, but rather ‘s’ e.g. Array ( [showposts] => 4 [paged] => 1 [s] => post [post_content] => tree [category__and] => Array ( [0] => 6 [1] => 15 [2] => 28 ) )
Post ID is not an argument in the_title() (see Codex article). Accepted arguments are: the_title( $before, $after, $echo ); Take a look at the source code. The function the_title() calls get_the_title() with no arguments, whereas get_the_title() takes a Post ID as its only argument. If you want the title of a post/page other than the … Read more
ad1. meta_values are strings, so they are ordered like strings, not dates. In SQL you should use some casting as a DATE before ordering ad2. better date format would be yyyy-mm-dd, because sorting this meta field like strings gives the same results as date-type column.. compare order of dates in yyyy-mm-dd 2010-03-06 2012-06-05 and the … Read more
Finally solved it! I needed to add this at the end of each loop 🙂 <?php $my_query = new WP_Query(array( ‘category_name’ => get_post_meta($post->ID, ‘featured’, true), ‘posts_per_page’ => 5, )); if ($my_query->have_posts()): ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> content etc goes here <?php endwhile; ?> <?php endif; ?><?php wp_reset_query(); ?> many thanks James
http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters ‘orderby’ => ‘modified’
Just use a custom query like this: $exclude_cats=”2,52,3″; $posts_per_page=”4″; $loop = new WP_Query(“category__not_in=$exclude_cats&posts_per_page=$posts_per_page”); if($loop->have_posts()): while($loop->have_posts()): $loop->the_post(); //Do stuff here the_content(), the_title() etc… endwhile; else: //Do something here endif;
You haven’t specified the ‘field’ value e.g. ‘field’ => ‘slug’, http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters
after some trials I’ve got one solution that seems to be good but I need some tweaking help <ul class=”list-ensemble”> <?php $terms = get_terms(“production_co_type”); $count = count($terms); if ( $count > 0 ){ echo “<ul>”; foreach ( $terms as $term ) { echo ‘<li class=”title”>’ . $term->name . ‘</li>’; $args = array ( ‘post-type’=> ‘shows’, … Read more
Do the following: Create a blank page with the name “Blog” or “News” or whatever you like to call it. Go to Settings -> Reading and select A static page from Front page displays section. Choose your front-page from the Front page dropdown box, and your blog page (the page you created in step 1) … Read more