Loop within category’s posts
Loop within category’s posts
Loop within category’s posts
I think these should be separate taxonomies. Category is actually a taxonomy in its own right. You would create a taxonomy for each of the filters/drop-downs. This may seem like overkill but i think it will make it easier to work on additional features down the road. Add the following method to your functions.php. Replace … Read more
A search box for all sites – Multisite
In short, yes! $args = array( ‘post_type’ => ‘summerartcamp’, ‘cat’ => 15, //This is for the Morning Group – I’ll have a second loop for the Afternoon Group ‘order’ => ‘ASC’, ‘meta_key’ => ‘_expiration-date’, ‘orderby’ => ‘meta_value’ ); $the_query = new WP_Query( $args ); if ( $the_query->have_posts() /* Make sure you use the method, not … Read more
As a first condition: Have you tried, if you retrieve sub categories at all? $sub_categories = get_terms( ‘product_cat’, $args2 ); echo ‘<pre>’;print_r( $sub_categories ); If you have sub categories, you would still have a problem with your foreach: foreach ($sub_categories as $subcat) { $sub_categories = $sub_categories.$subcat->name.’,’; } You are overwriting $sub_categories with the first time, … Read more
Make related posts display first in search result
This is not an optimal answer, but it works well enough for the client to have a page that does what they want. Since I cannot seem to find a function that will do the nested loops as described above, I used a series of query objects, one for each year the client would like … Read more
You don’t have to set that code in your functions.php. Naming a file single-press.php should do the trick if you named well you custom post type when you declared it. The post type should continue to use single.php. I this doesn’t work, please provide wp version and custom post type declaration.
That happens because WordPress reads your old post name as category name now – and it cannot find that category. Solution: filter 404_template and try to find the post and its permalink. Then redirect. <?php # -*- coding: utf-8 -*- /* Plugin Name: Redirect to category */ add_filter( ‘404_template’, ‘t5_redirect_to_category’ ); function t5_redirect_to_category( $template ) … Read more
You can go with two queries, the first to get your taxonomies like this : $categories = get_categories(); More infos about the params here. And then browse your category collections and get the first n posts of it like this : foreach($categories as $cat) { //get the $n posts from this category $post_query = new … Read more