感谢您的回复,1月&;稀有的。他们为我指明了正确的方向。这就是我的结局。
这将禁用内容中的短代码。非常适合此网站;函数获取附加图像;把它们列成一个列表。(我在某处找到了该函数,并将其精简了一点)
// Removed shortcodes from the content
add_filter(\'the_content\', \'strip_shortcodes\');
// Get attached images & spits out a list of them.
function nerdy_get_images($size = \'thumbnail\', $limit = \'0\', $offset = \'0\') {
global $post;
$images = get_children( array(\'post_parent\' => $post->ID, \'post_status\' => \'inherit\', \'post_type\' => \'attachment\', \'post_mime_type\' => \'image\', \'order\' => \'ASC\', \'orderby\' => \'menu_order ID\') );
if ($images) {
$num_of_images = count($images);
if ($offset > 0) : $start = $offset--; else : $start = 0; endif;
if ($limit > 0) : $stop = $limit+$start; else : $stop = $num_of_images; endif;
$i = 0;
foreach ($images as $image) {
if ($start <= $i and $i < $stop) {
$img_title = $image->post_title; // title.
$img_description = $image->post_content; // description.
$img_caption = $image->post_excerpt; // caption.
$img_url = wp_get_attachment_url($image->ID); // url of the full size image.
$preview_array = image_downsize( $image->ID, $size );
$img_preview = $preview_array[0]; // thumbnail or medium image to use for preview.
?>
<li>
<a href="<?php echo $img_url; ?>"><img src="<?php echo $img_preview; ?>" alt="<?php echo $img_caption; ?>" title="<?php echo $img_title; ?>"></a>
</li>
<?
}
$i++;
}
}
}
这是单打电话。php
<ul>
<?php nerdy_get_images(\'medium\',\'0\',\'0\'); ?>
</ul>
这张单子正是我想要的。
再次感谢各位!