Loop through custom taxanomy in post and display custom fields from posts

You are going to need set up a new WP_Query in your content-*.php with the correct parameters in order to send it into a loop. <?php $args = array( ‘tax_query’ => array( array( ‘taxonomy’ => ‘recipes’,. ‘field’ => ‘slug’, ‘terms’ => ‘dessert’ ))); $your_posts = new WP_Query( $args ); ?> You can add any other … Read more

How to get attached image to taxonomy..?

If your going to reference the uploads directory use https://developer.wordpress.org/reference/functions/wp_upload_dir/ <?php $upload_dir = wp_upload_dir(); // Array of key => value pairs /* $upload_dir now contains something like the following (if successful) Array ( [path] => C:\path\to\wordpress\wp-content\uploads\2010\05 [url] => http://example.com/wp-content/uploads/2010/05 [subdir] => /2010/05 [basedir] => C:\path\to\wordpress\wp-content\uploads [baseurl] => http://example.com/wp-content/uploads [error] => ) // Descriptions [path] – … Read more

List Top 5 taxonomy terms based on number of post

Here I’ve written a SQL query based function for you. You can use it to also for getting the top taxonomy terms based on post date range. Here it is- function the_dramatist_get_taxonomy_based_on_date_range_and_post_count( $args = array() ) { global $wpdb; $default_args = array( ‘taxonomy’ => ‘category’, ‘start_date’ => date(‘Y-m-d’), ‘end_date’ => date(‘Y-m-d’, strtotime(‘tomorrow’)), ); $args = … Read more

Using Advanced Custom Fields Relationship Field to select a taxonomy term

This is based on the assumption that you have a custom field called “show_on_tax” for the custom taxonomy “Directory Entry Type”, which appears when editing a small banner (See image below). This allows you to select which custom tax terms you want the banners to appear on. This should get you sorted but drop a … Read more

Search only custom taxonomies

Create a search form that submits a field called “name”. In the file that handles form submissions, // get the “name” the visitor searched for $term = $_POST[‘name’]; // query: find all posts with the ‘people’ taxonomy set to the “name” they searched for $args = array( ‘post_type’ => ‘post’, // or insert your custom … Read more