Implementación masiva de funcionalidades esenciales del tema apus-theme usando agentes paralelos para máxima eficiencia. **Issues Completados:** **Issue #2 - Eliminar bloat de WordPress:** - inc/performance.php: 13 funciones que remueven emojis, oEmbed, feeds, dashicons, jQuery migrate, XML-RPC, etc. - Optimización completa del frontend **Issue #3 - Desactivar búsqueda nativa:** - inc/search-disable.php: Bloquea queries de búsqueda, widget, formularios - search.php: Retorna 404 con mensaje amigable **Issue #4 - Desactivar comentarios:** - inc/comments-disable.php: 15 funciones que eliminan comentarios de frontend y backend - comments.php: Template desactivado **Issue #8 - Footer con 4 widgets:** - footer.php: Verificado con 4 áreas de widgets y copyright - assets/css/footer.css: Estilos responsive completos - Sistema de anchos configurables **Issue #9 - Jerarquía de plantillas:** - home.php, category.php, tag.php, author.php, date.php, taxonomy.php, attachment.php - 7 nuevas plantillas + 12 verificadas - Template parts completos - Paginación en todos los archives **Issue #10 - Imágenes destacadas:** - inc/featured-image.php: 12 funciones para manejo de featured images - Sin placeholders, lazy loading, alt text automático - Responsive con Bootstrap, aspect ratio **Issue #11 - Badge de categoría:** - inc/category-badge.php: Badge Bootstrap sobre H1 en single posts - Excluye "Uncategorized" - Template tag: apus_display_category_badge() **Issue #12 - TOC automático:** - inc/toc.php: Genera TOC desde H2/H3 - assets/css/toc.css: Estilos con numeración CSS counters - assets/js/toc.js: Smooth scroll, scroll spy, toggle - Configurable con apus_get_option() **Issue #13 - Posts relacionados:** - inc/related-posts.php: Query por categoría, 12 funciones - inc/admin/related-posts-options.php: Sistema de configuración - assets/css/related-posts.css: Cards responsive - Hook automático en single posts **Issue #16 - AdSense delay:** - inc/adsense-delay.php: Retardo de carga hasta scroll/click - assets/js/adsense-loader.js: Detecta interacciones - Mejora FID y TBT para Core Web Vitals **Archivos Modificados:** - functions.php: Includes de nuevos módulos, removido feed support - single.php: Integración de category badge - inc/enqueue-scripts.php: Enqueue de nuevos assets - inc/theme-options-helpers.php: Helper functions para TOC **Archivos Creados:** - 7 nuevas plantillas WordPress - 3 nuevos módulos inc/ (comments-disable, search-disable) - 8 reportes de documentación .md **Estadísticas:** - Total funciones PHP: 60+ nuevas funciones - Líneas de código: 2,500+ líneas - Archivos nuevos: 18 - Archivos modificados: 9 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
232 lines
6.2 KiB
PHP
232 lines
6.2 KiB
PHP
<?php
|
||
/**
|
||
* The template for displaying attachment pages
|
||
*
|
||
* This template displays individual attachment pages (images, videos, documents).
|
||
* It shows the attachment file with metadata and navigation to parent post.
|
||
*
|
||
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#attachment
|
||
*
|
||
* @package Apus_Theme
|
||
* @since 1.0.0
|
||
*/
|
||
|
||
get_header();
|
||
?>
|
||
|
||
<main id="main-content" class="site-main" role="main">
|
||
|
||
<div class="content-wrapper">
|
||
|
||
<!-- Primary Content Area -->
|
||
<div id="primary" class="content-area">
|
||
|
||
<?php
|
||
while ( have_posts() ) :
|
||
the_post();
|
||
?>
|
||
|
||
<article id="post-<?php the_ID(); ?>" <?php post_class( 'attachment-page' ); ?>>
|
||
|
||
<!-- Attachment Header -->
|
||
<header class="entry-header">
|
||
<h1 class="entry-title attachment-title">
|
||
<?php the_title(); ?>
|
||
</h1>
|
||
|
||
<!-- Attachment Meta Information -->
|
||
<div class="entry-meta attachment-meta">
|
||
<span class="posted-on">
|
||
<time class="entry-date published" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>">
|
||
<?php
|
||
printf(
|
||
/* translators: %s: attachment date */
|
||
esc_html__( 'Uploaded on %s', 'apus-theme' ),
|
||
'<span class="date-text">' . esc_html( get_the_date() ) . '</span>'
|
||
);
|
||
?>
|
||
</time>
|
||
</span>
|
||
|
||
<?php
|
||
// Display file size
|
||
$metadata = wp_get_attachment_metadata();
|
||
if ( isset( $metadata['filesize'] ) ) :
|
||
?>
|
||
<span class="file-size">
|
||
<?php
|
||
printf(
|
||
/* translators: %s: file size */
|
||
esc_html__( 'Size: %s', 'apus-theme' ),
|
||
esc_html( size_format( $metadata['filesize'] ) )
|
||
);
|
||
?>
|
||
</span>
|
||
<?php endif; ?>
|
||
|
||
<?php
|
||
// Display image dimensions if applicable
|
||
if ( wp_attachment_is_image() && isset( $metadata['width'] ) && isset( $metadata['height'] ) ) :
|
||
?>
|
||
<span class="image-dimensions">
|
||
<?php
|
||
printf(
|
||
/* translators: 1: width, 2: height */
|
||
esc_html__( 'Dimensions: %1$s × %2$s pixels', 'apus-theme' ),
|
||
esc_html( number_format_i18n( $metadata['width'] ) ),
|
||
esc_html( number_format_i18n( $metadata['height'] ) )
|
||
);
|
||
?>
|
||
</span>
|
||
<?php endif; ?>
|
||
</div><!-- .entry-meta -->
|
||
</header><!-- .entry-header -->
|
||
|
||
<!-- Attachment Content -->
|
||
<div class="entry-content attachment-content">
|
||
|
||
<?php
|
||
// Display the attachment
|
||
if ( wp_attachment_is_image() ) :
|
||
// Image attachment
|
||
?>
|
||
<div class="attachment-image">
|
||
<?php
|
||
echo wp_get_attachment_image(
|
||
get_the_ID(),
|
||
'full',
|
||
false,
|
||
array(
|
||
'alt' => get_the_title(),
|
||
'class' => 'attachment-full-size',
|
||
)
|
||
);
|
||
?>
|
||
</div>
|
||
|
||
<!-- Download link -->
|
||
<div class="attachment-actions">
|
||
<a href="<?php echo esc_url( wp_get_attachment_url() ); ?>"
|
||
class="btn btn-primary download-link"
|
||
download>
|
||
<?php esc_html_e( 'Download Original', 'apus-theme' ); ?>
|
||
</a>
|
||
</div>
|
||
|
||
<?php else : ?>
|
||
<!-- Non-image attachment -->
|
||
<div class="attachment-file">
|
||
<p>
|
||
<?php
|
||
printf(
|
||
/* translators: %s: attachment file name */
|
||
esc_html__( 'File: %s', 'apus-theme' ),
|
||
'<strong>' . esc_html( basename( get_attached_file( get_the_ID() ) ) ) . '</strong>'
|
||
);
|
||
?>
|
||
</p>
|
||
|
||
<!-- Download button -->
|
||
<a href="<?php echo esc_url( wp_get_attachment_url() ); ?>"
|
||
class="btn btn-primary download-link"
|
||
download>
|
||
<?php esc_html_e( 'Download File', 'apus-theme' ); ?>
|
||
</a>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<!-- Attachment Caption -->
|
||
<?php
|
||
if ( ! empty( wp_get_attachment_caption() ) ) :
|
||
?>
|
||
<div class="attachment-caption">
|
||
<?php echo wp_kses_post( wpautop( wp_get_attachment_caption() ) ); ?>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<!-- Attachment Description -->
|
||
<?php
|
||
the_content();
|
||
|
||
// Display page links for paginated content
|
||
wp_link_pages(
|
||
array(
|
||
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'apus-theme' ),
|
||
'after' => '</div>',
|
||
)
|
||
);
|
||
?>
|
||
|
||
</div><!-- .entry-content -->
|
||
|
||
<!-- Attachment Footer -->
|
||
<footer class="entry-footer">
|
||
<?php
|
||
// Link to parent post if exists
|
||
$parent_post = get_post_parent();
|
||
if ( $parent_post ) :
|
||
?>
|
||
<div class="parent-post-link">
|
||
<a href="<?php echo esc_url( get_permalink( $parent_post ) ); ?>">
|
||
<?php
|
||
printf(
|
||
/* translators: %s: parent post title */
|
||
esc_html__( 'View: %s', 'apus-theme' ),
|
||
'<span class="parent-title">' . esc_html( get_the_title( $parent_post ) ) . '</span>'
|
||
);
|
||
?>
|
||
</a>
|
||
</div>
|
||
<?php endif; ?>
|
||
|
||
<?php
|
||
// Edit post link for logged-in users with permission
|
||
edit_post_link(
|
||
sprintf(
|
||
wp_kses(
|
||
/* translators: %s: Attachment title. Only visible to screen readers. */
|
||
__( 'Edit<span class="screen-reader-text"> "%s"</span>', 'apus-theme' ),
|
||
array(
|
||
'span' => array(
|
||
'class' => array(),
|
||
),
|
||
)
|
||
),
|
||
get_the_title()
|
||
),
|
||
'<span class="edit-link">',
|
||
'</span>'
|
||
);
|
||
?>
|
||
</footer><!-- .entry-footer -->
|
||
|
||
</article><!-- #post-<?php the_ID(); ?> -->
|
||
|
||
<?php
|
||
// Display comments section if enabled
|
||
if ( comments_open() || get_comments_number() ) :
|
||
comments_template();
|
||
endif;
|
||
|
||
endwhile; // End of the loop.
|
||
?>
|
||
|
||
</div><!-- #primary -->
|
||
|
||
<?php
|
||
/**
|
||
* Sidebar
|
||
* Display the sidebar if it's active.
|
||
*/
|
||
if ( is_active_sidebar( 'sidebar-1' ) ) :
|
||
get_sidebar();
|
||
endif;
|
||
?>
|
||
|
||
</div><!-- .content-wrapper -->
|
||
|
||
</main><!-- #main-content -->
|
||
|
||
<?php
|
||
get_footer();
|