single-mySlug.php works: archive-mySlug.php does not. Custom Post Type

Your setup would mean that archive-listing.php would be used at: http://martcol.co.uk/listing/ However, your URL: http://martcol.co.uk/listing/organisation/children/ Is not a post archive, it’s a taxonomy archive, specifically an organisation archive, and so archive-listing.php will never be used for it, since archive-listing is not a taxonomy archive template but a post archive template. Other than doing an include … Read more

link posts to custom post type

Try Posts to Posts Plugin This plugin allows you to create many-to-many relationships between posts of any type: post, page, custom etc. A few example use cases: manually curated lists of related posts post series products connected to retailers etc. Additionally, you can create many-to-many relationships between posts and users. So, you could also implement: … Read more

Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax

You are looping through all states and running a query on each iteration, but the query you are doing is nothing to do with the loop. You are checking for $_GET[‘state’], which would be the state passed over the query string. <?php foreach ( $states as $state ) { $state_query = new WP_Query( array( ‘post_type’ … Read more

Pagination not working with custom loop

I’ve run into this problem with PageNavi before. My solution is to hijack the $wp_query variable temporarily and then reassign it after closing the loop. An exmaple: <?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; $args=array( ‘post_type’=>’post’, ‘cat’ => 6, ‘posts_per_page’ => 5, ‘paged’=>$paged ); $temp = $wp_query; $wp_query= null; $wp_query = new WP_Query($args); /* … Read more