我需要在「the_content」中檢索img的src,並且還需要在最後一個錨點中打印它,如下面代碼中所示。我從我的知識和互聯網上嘗試了幾乎所有的東西,但沒有運氣。 plz幫助。
我刪除了我嘗試過的所有東西,並將乾淨的代碼放在一邊,以便你們可以輕鬆地理解它。需要獲取圖像的url/src
<?php query_posts('cat=7');?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="impresna zoom-img" id="zoom-img">
<?php the_content(); // it contain images>
<span class="main"><span class="emboss">MARCA - SP</span><?php the_date(); ?>
<a class="lb_gallery" href="need to print url of image here">+ZOOM</a></span>
<br clear="all" />
</div>
<?php endwhile; ?>
<?php endif; ?>
不使用'query_posts'對加載速度非常不利。使用'WP_Query'參見這裏:http://codex.wordpress.org/Class_Reference/WP_Query#Usage – janw