我正在尝试从图像数组中提取替代文本以在其他地方使用,但我无处可去..
这是代码:
global $post;
$args = array( 'numberposts' => 12, 'post_type' => 'clientes', 'orderby' => 'ASC');
$myposts = get_posts( $args );
$alt_text = get_post_meta($args , '_wp_attachment_image_alt', true);
foreach( $myposts as $post ) : setup_postdata($post);
?>
<li>
<!--BEGIN .hentry -->
<div class="post_box">
<div class="post-thumb left gallery">
<a href="<?php the_permalink() ?>">
<?php the_post_thumbnail('full'); ?>
<div class="overlay"><img src="<?php echo $alt_text; ?>.jpg" /></div>
</a>
</div>
<!--END .hentry-->
</div>
我很确定我的错在于这条线:
$alt_text = get_post_meta($args , '_wp_attachment_image_alt', true);
但我缺乏修复它的知识......
谢谢
b