【发布时间】:2013-12-04 16:18:20
【问题描述】:
这是一个与在附件页面上添加标题属性相关的 WP/SEO 问题。我们使用的是 211 主题和默认的 image.php 代码,如下所示。
我们想要拉入标题标签(甚至自动为所有图像设置标题,因此用户不必单独设置,或者只是使用帖子标题作为标题 - 任何这些)。
查看源代码中的 html 如下所示:
image.php 代码:
<a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
$attachment_size = apply_filters( 'twentyeleven_attachment_size', 848 );
echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height.
?></a>
【问题讨论】: