WordPress.org

Ready to get started?Download WordPress

Forums

Show all posts by author - including custom posts types (6 posts)

  1. adam533
    Member
    Posted 4 years ago #

    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?

  2. Hax
    Member
    Posted 4 years ago #

    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/

  3. adam533
    Member
    Posted 4 years ago #

    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?

  4. Hax
    Member
    Posted 4 years ago #

    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

  5. vlad_paun
    Member
    Posted 3 years ago #

    @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.

  6. ericgallagher
    Member
    Posted 3 years ago #

    @vlad_paun,

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

Topic Closed

This topic has been closed to new replies.

About this Topic