好的,我有一个非常简单的问题。但我不擅长php,所以在这里发布。我的投资组合项目输出的锚定标记如下:
<a href="http://localhost/dianero/portfolio/kahida/" rel="41">kahida</a>
&;我的缩略图输出如下:
<img width="792" height="535" src="http://localhost/dianero/wp-content/uploads/2014/12/pic3.jpg" class="main-image portfolio wp-post-image" alt="pic3" id="photo_" style="display: none;">
正如你所看到的,我的缩略图有id“photo\\u0”。我想要的是将锚定标记rel值添加到此id。因此它们看起来是:“photo\\u 41”、“photo\\u 42”&;等等。。。
我的wp页面代码如下:
<div class="main-interior portfolio" id="portfolio-big-pics" style="display: block;">
<?php $args = array( \'post_type\' => \'portfolio\', \'order\' => \'ASC\');
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php $extraLastClass = $loop->current_post + 1 === $loop->post_count ? \' main-image-porfolio-main\' : \'\';?>
<?php
$attributes = array(
"class" => "main-image portfolio " . $extraLastClass,
"id" => "photo_",
);
the_post_thumbnail("large", $attributes);
?>
<?php endwhile; ?>
<?php rewind_posts(); ?>
<div class="portfolio-box">
<h5>Portfolio</h5>
<ul class="item-list" id="portfolio-list">
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<li><a href="<?php the_permalink(); ?>" rel="<?php echo $post->ID; ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
</div>
</div>
那么我该怎么做呢?