custom-taxonomy

How to show posts in taxonomy loop – WordPress Website Design Article

I have a nested list of a particular taxonomy but it only shows the taxonomy names. I want to actually show the list of posts for that custom post type for that taxonomy. Do I need to use WP_Query to get the posts or what is the best way to achieve this? <?php $categories = get_terms( ‘my-taxonomy’, array( ‘hide_empty’ => 0, ) ); $subcategories = $subsubcategories = $categories; foreach ( $categories as $category ) { // Only top level terms…

Read More

Showing a count for custom post type and taxonomy – WordPress Website Design Article

Using WP Job Manager, I’d like to present a section on a page where I can show 4 selected categories, and under each category to display a count of how many listings are in it. I have the custom post type “job_listing”, the taxonomy “job_listing_category” and tag ID for each of the categories (e.g. 106) Been searching on SE for few hours to no avail – any help is appreciated. Also, is there a way to achieve the same with…

Read More

Custom post type single with custom URL structure – WordPress Website Design Article

I have a function that rewrites the URL before post slug including a custom taxonomy function wpa_show_permalinks( $post_link, $post ){ if ( is_object( $post ) && $post->post_type == ‘aktuelles’ ){ $terms = wp_get_object_terms( $post->ID, ‘nachrichtenkategorie’ ); if( $terms ){ return str_replace( ‘%nachrichtenkategorie%’ , $terms[0]->slug , $post_link ); } } return $post_link; } add_filter( ‘post_type_link’, ‘wpa_show_permalinks’, 1, 2 ); The function works just fine and replaces %nachrichtenkategorie% in URL when accessing from the archive Getting the permalink of a post with…

Read More