Get the terms of a custom taxonomy for a specific author in author template

First get a list of the author posts then loop over the each post and get the terms used ex: function list_author_used_terms($author_id){ // get the author’s posts $posts = get_posts( array(‘post_type’ => ‘custom_post_type_name’, ‘posts_per_page’ => -1, ‘author’ => $author_id) ); $author_terms = array(); //loop over the posts and collect the terms foreach ($posts as $p) … Read more

Correct way to use get_template_part() and get_post_format() with custom post types?

What you’ve done will include content-competitions-<post-format>.php. I don’t know if that is what you want, but that is correct as far as structure goes. I also don’t know what you mean by “to change that one line”, but get_template_part will use the two parameters to construct a file name/path so, yes, you do need to … Read more

Add information above a custom post type listing of all posts page

You can use the admin_notices action for that: function wpa_admin_notice() { $screen = get_current_screen(); if( ‘your_post_type’ == $screen->post_type && ‘edit’ == $screen->base ){ ?> <div class=”updated”> <p>Here is some text</p> </div> <?php } } add_action( ‘admin_notices’, ‘wpa_admin_notice’ ); Change your_post_type to whatever your custom post type slug is. Also see get_current_screen for more info on … Read more

Display Posts of a Category in Alphabetical Order (Custom Post Type)

Use the pre_get_posts action to modify the query before it is run. Place this in your theme’s functions.php: function wpd_tax_alpha( $query ) { if ( $query->is_tax(‘link-category’) && $query->is_main_query() ) { $query->set( ‘orderby’, ‘title’ ); $query->set( ‘order’, ‘ASC’ ); } } add_action( ‘pre_get_posts’, ‘wpd_tax_alpha’ );

Categories and Tags not working!

Category and Tag archive pages only query for the post post type. If you want custom post types to appear on those pages, you need to modify the query via pre_get_posts to add additional types. function wpd_womens_blog_taxonomy_queries( $query ) { if ( ( $query->is_category() || $query->is_tag() ) && $query->is_main_query() ) { $query->set( ‘post_type’, array( ‘post’, … Read more