Get Posts by Custom Taxonomy on Custom Post

<?php // get the WP_Query object $query = new WP_Query($args); // Missed essential point: // loop through the WP_Query object // to get the array of distinct posts objects $coaches = $query->posts; // each $coach is distinct post object now foreach( $coaches as $coach ) { // echo $coach->ID; }

Auto add custom taxonomy to permalink when save

Please check the following code, you have to assign the custom taxonomy name to $taxonomy variable. And only the first taxonomy term will be appended to the post slug. add_filter( ‘wp_insert_post_data’, function( $data, $postarr ) { /** * Only for post posttype and when the post is created */ if ( empty( $postarr[‘save’] ) && … Read more

How to create a permalink structure with custom taxonomies and custom post types

I suspect the extra slash is coming from the str_replace action because normally there’s no need to manually add slashes when retrieving TAX urls. Since you now end up with 1 unwanted slash, I would recommend testing situations with/without the slash. Starting with removing the one in the function definition. Make it empty, see what … Read more

Create a Hierarchical List of Custom Taxonomies AND Posts

I’ve been working on a solution this afternoon and have come up with the following. It may not be the most elegant way of doing this though, so I’m open to further comments. function custom_tax_list_and_posts() { $post_type=”CUSTOM_POST_TYPE_NAME”; $taxonomy = ‘CUSTOM_TAXONOMY_NAME’; // Get all of the parent terms in the custom taxonomy and include empty ones … Read more

Taxonomy Category Icon on index page

Since you want the icons to appear in a specific place, this seems more like theme territory rather than plugin. One way to achieve your goal: Create a child theme (or edit the one you’re already using). Copy your homepage template (it’s unlikely you want to change index.php; you’re probably looking for front-page.php or home.php, … Read more