Support » Plugin: Toolset Types - Custom Post Types, Custom Fields and Taxonomies » [Plugin: Types – Custom Fields and Custom Post Types Management] No Custom Posts on Author summary p

  • Hi,

    There are no custom posts showing on the Author’s summary page, even though the author created a custom post.

    Now I had to add this code to my functions.php to get custom posts to show in the main index blog feed
    // add Articles custom post type to home page feed

    add_filter( 'pre_get_posts', 'my_get_posts' );

    function my_get_posts( $query ) {

    if ( ( is_home() && false == $query->query_vars['suppress_filters'] ) || is_feed() )
    $query->set( 'post_type', array( 'post', 'article' ) );

    return $query;
    }

    Is there something similar I have to do to have custom post show up on the author’s page?

    Thanks. I do really like this module btw.

    M

    http://wordpress.org/extend/plugins/types/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Amir Helzer

    (@amirhelzer)

    This really depends on your theme. If the theme is not loading these custom posts, they will not show.

    Amir,

    There must be a few lines of code I can add to functions.php to get this to work. The custom post types work everywhere else on my site, except on the author pages. Any help would be really appreciated. Can you at least point me in the right direction?

    Thanks,
    Michael

    Ok, googled and found a solution. Amir, I might suggest adding it to your FAQ or other documentation.

    To fix the authors page to show custom posts add the following code to your functions.php file. Note the array is used to display multiple post types. If you need to display only one type, remove the array.

    function custom_post_author_archive( &$query )
    {
        if ( $query->is_author )
            $query->set( 'post_type', array( 'post', 'your-custom-type-here' ) );
        remove_action( 'pre_get_posts', 'custom_post_author_archive' ); // run once!
    }
    add_action( 'pre_get_posts', 'custom_post_author_archive' );

    Hope that helps anyone else stuck on this.

    Plugin Author Amir Helzer

    (@amirhelzer)

    Thanks for posting the code here. I’m sure that others will find it useful as well.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Types – Custom Fields and Custom Post Types Management] No Custom Posts on Author summary p’ is closed to new replies.