リライトルールを追加して、post_status の指定をすると、メディアもアーカイブ表示ができるんですよ。奥さん。
ただし、is_home が true になるので、そのままだと home.php か、index.php での表示になってしまうのですけどね。
function add_attachiment_archive_rule() {
$add_rules = array(
'top' => array(
'attachment/page/[0-9]{1,}/?$' => 'index.php?post_type=attachment&paged=$matches[1]',
'attachment/?$' => 'index.php?post_type=attachment'
),
'bottom' => array(
)
);
foreach ( $add_rules as $position => $rules ) {
foreach ( $rules as $rewrite => $rule ) {
add_rewrite_rule( $rewrite, $rule, $position );
}
}
}
add_action( 'init', 'add_attachiment_archive_rule' );
function attachment_archve_post_status( $wp_query ) {
if ( ! is_admin() && $wp_query->is_main_query() ) {
if ( ! is_singular() && $wp_query->get( 'post_type' ) == 'attachment' ) {
$wp_query->set( 'post_status', 'inherit' );
}
}
}
add_action( 'pre_get_posts', 'attachment_archve_post_status' );