WordPress.org

Make WordPress Core

Ticket #38160: 38160.diff

File 38160.diff, 695 bytes (added by birgire, 2 years ago)
  • src/wp-includes/template.php

    diff --git src/wp-includes/template.php src/wp-includes/template.php
    index 4205ce9..68db601 100644
    function get_single_template() { 
    498498                $templates[] = "single-{$object->post_type}.php";
    499499        }
    500500
     501        if( is_attachment() ) {
     502                $templates[] = "attachment.php";
     503        }
     504
    501505        $templates[] = "single.php";
    502506
    503507        return get_query_template( 'single', $templates );
    function get_attachment_template() { 
    608612                }
    609613                $templates[] = "{$type}.php";
    610614        }
    611         $templates[] = 'attachment.php';
     615
     616        if( ! is_single() ) {
     617                $templates[] = 'attachment.php';
     618        }
    612619
    613620        return get_query_template( 'attachment', $templates );
    614621}