我已經使用WP模板建立一個簡單的網站http://wpshower.com/themes/expositio/WordPress的PHP回聲替代文字
該網站是:Mathiaswarnich.dk
這是正常的,但它並不顯示ALT文本,我想不通的PHP出發。這是圖像的代碼:
* The template for displaying image attachments
// Retrieve attachment metadata.
$metadata = wp_get_attachment_metadata();
get_header();
?>
<section id="primary" class="content-area image-attachment">
<div id="content" class="site-content" role="main">
<header class="entry-header">
<?php the_title('<h1 class="entry-title">', '</h1>'); ?>
<div class="entry-meta">
<div class="full-size-link">
<a href="<?php echo wp_get_attachment_url(); ?>"><?php echo $metadata['width']; ?> × <?php echo $metadata['height']; ?></a>
</div>
<div class="parent-post-link">
<a href="<?php echo get_permalink($post->post_parent); ?>" rel="gallery"><?php echo get_the_title($post->post_parent); ?></a>
</div>
</div>
</header><!--
--><article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-content">
<div class="entry-attachment">
<div class="attachment">
<?php expositio_the_attached_image(); ?>
</div><!-- .attachment -->
<?php if (has_excerpt()) : ?>
<div class="entry-caption">
<?php the_excerpt(); ?>
</div><!-- .entry-caption -->
<?php endif; ?>
</div><!-- .entry-attachment -->
<?php
the_content();
wp_link_pages(array(
'before' => '<div class="page-links"><span class="page-links-title">'.__('Pages:', 'expositio').'</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
));
?>
你在哪裏打印ALT? –
你必須找到這個函數'expositio_the_attached_image();'定義和修改的位置(如果你自己沒有設法執行它,可能會顯示它的代碼和文件名) – Kaddath
找到它: \t function expositio_the_attached_image() { \t \t $ post = get_post(); \t \t */ \t \t $ attachment_size = apply_filters('expositio_attachment_size',array(810,810)); \t \t $ next_attachment_url = wp_get_attachment_url(); \t \t $ attachment_ids = get_posts(陣列( \t \t \t 'post_parent'=> $後> post_parent, \t \t \t '字段'=> 'IDS', \t \t \t 'numberposts'=> -1, \t \t \t 'post_status'=> '繼承', \t \t \t 'post_type'=> '附着', \t \t \t 'post_mime_type'=> '圖像', \t \t \t '順序'=> 'ASC', \t \t \t '的OrderBy'=> 'menu_order ID', \t \t)); –