Quantcast
Channel: Toolset » All Posts
Viewing all articles
Browse latest Browse all 20145

Author Archives that list Custom Post Types

$
0
0

I'm still trying to figure out how to get an author archive that will display custom post types. You said in this thread that your archives don't work with CPTs.

http://wp-types.com/forums/topic/custom-author-page/

I found this function online which is widely reported to work well for just this issue

function custom_post_author_archive($query) {
    if ($query->is_author)
        $query->set( 'post_type', array('pub', 'post') );
    remove_action( 'pre_get_posts', 'custom_post_author_archive' );
}
add_action('pre_get_posts', 'custom_post_author_archive');

but it's not working for me (added to the functions.php file). I've checked it in other themes, and I've disabled all the plugins except yours and it still doesn't work. Do you see any reason that function would not work with your plugins, or if you know how I can amend it to work? This is a critical issue for the site, and I'm stuck.

FYI, "pub" is the slug name for the CPT I created with Types.


Viewing all articles
Browse latest Browse all 20145

Trending Articles