Support » Fixing WordPress » Show all posts by author – including custom posts types

  • I am using the code the_author_posts_link and it is not working for a custom post type I setup. I have authors posting normal posts and also this custom post type (photos). I made sure to set photos as a post type and not page. When clicking the link though it does not return any of the custom posts types. How can I set that up correctly?

Viewing 5 replies - 1 through 5 (of 5 total)
  • just creating custom post types will not, you have to be sure that the author is been assign to the post type (photos) also if you want this post type to show in categories(taxomony) you need to sign it to the new custom post type. here is a good plug in that can show you visually want is assign to what and you can modify taxonomy too.

    http://wordpress.org/extend/plugins/gd-taxonomies-tools/

    Not exactly clear on how to assign an author to the post type (photos in this example). Is this something I would do in the functions file where I created the post type and taxonomies?

    no when you create a new post wp_insert_post() you have to be sure that you assign your custom post type and author id, check you database to be sure that your new post and post type have an author assign to it.

    http://codex.wordpress.org/Function_Reference/wp_insert_post

    @adam533

    You should try adding this into function.php (or a plugin):

    function add_pagination_to_author_page_query_string($query_string)
    {
        if (isset($query_string['author_name'])) $query_string['post_type'] = array('post','news');
        return $query_string;
    
    }
    add_filter('request', 'add_pagination_to_author_page_query_string');

    and replace “news” with your custom post type slug.

    Then a wp-pagenavi should work just fine.

    @vlad_paun,

    Thank you for the easy quick fix. It’s nice to have simple answers and quick fixes.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show all posts by author – including custom posts types’ is closed to new replies.