Timber plugin (Twig) does not show custom type posts in index page [closed]

A couple quick notes before we get started:

  1. I don’t think this is a timber problem. (If it is, 3rd-party plugin/theme posts are off topic for this forum.)
  2. Be careful about using generic sounding functions like register_post_types(). You never know when WordPress might introduce a function like that and it’s generic enough that some other plugin or theme might think to use it too. So to avoid conflicts, you should always prefix your functions with your initials or a client accronym or, as in the answer below, your WPSE question #! If your post type is something common too (like person or business or project), give its slug a prefix too.

When you say “index page,” I assume you mean your “page for posts” (aka “blog”) which will use an index.php file in your theme if a home.php file isn’t present.

However, if all you want is for a custom post type to show up on the page for posts page, you can do that with pre_get_posts! This goes with your register_post_type() function.

function wpse162065_pre_get_posts( $query ) {
    if( is_home() && is_main_query() ) {
        $query->set( 'post_type', array( 'post', 'test' ) );
    }
}
add_action( 'pre_get_posts', 'wpse162065_pre_get_posts' );