michaelgodfrey
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: WP_Query navigation issue with custom taxonomyMuch research showed that the only problem is that in the reading section on the dashboard, one must match the posts_per_page with the ‘blogs pages show at most’ setting.
This also made a difference:
$paged = 1; if ( get_query_var('paged') ) $paged = get_query_var('paged'); if ( get_query_var('page') ) $paged = get_query_var('page');
I got different behaviors out of the 3 different nav types base on the value being paged vs. page.
I looked for a method to detach the ‘blogs pages show at most’ from the posts_per_page setting. I was hoping to have the number displayed to be different on standard and mobile themes. This showed lots of promise, but I never managed to get it to implement right:
https://wp.tutsplus.com/tutorials/custom-post-type-pagination-chaining-method/
So for now I’ll use the one global setting.
Forum: Fixing WordPress
In reply to: Multiple categories on index pageSolved.
Took a lot of trial and error, but here is what finally worked. The solution requires ‘tax_query’ and arrays within arrays.<?php $folio_loop = new WP_Query( array( 'post_type' => 'individuals', 'post_status' => 'publish', 'tax_query' => array( 'relation' => 'OR', array( 'taxonomy' => 'home-location', 'terms' => array('new-york','new-jersey','connecticut'), 'field' => 'slug', ), array( 'taxonomy' => 'visiting-location', 'terms' => array('visiting-new-york'), 'field' => 'slug', ), ), 'posts_per_page' => -1, 'orderby' => 'menu_order') ); ?>
Forum: Fixing WordPress
In reply to: Multiple categories on index pageUpdate:
I’m getting closer. The custom taxonomies and custom post types seemed to play a big factor.
I can do a new WP_Query
<?php $folio_loop = new WP_Query( array( 'post_type' => 'individuals', 'posts_per_page' => -1, 'home-location' => 'los-angeles', 'orderby' => 'menu_order') ); ?>
The above code will overide all individuals that live in new-york with los-angeles. So my query loop is working. Now my problem is how to properly array it. I’ve experimented and when I add a second value, I get every individual from every location in my query. The below example is one such attempt.
<?php $folio_loop = new WP_Query( array( 'post_type' => 'individuals', 'posts_per_page' => -1, array( 'home-location' => 'new-york', 'visiting-location' => 'visiting-new-york'), 'orderby' => 'menu_order') ); ?>
I would think that this would give me people living in the New York taxonomy and the people in the visiting taxonomy as well.