を考え出しました。
は今、特定のポストにアップロードされた任意の画像を
<?php postimage('thumbnail'); ?>
を次に
<?php
function postimage($size=medium,$num=1,$lighbox=1) {
if ($images = get_children(array(
'post_parent' => get_the_ID(),
'post_type' => 'attachment',
'numberposts' => $num,
'order' => 'ASC',
'orderby' => 'ID',
'post_mime_type' => 'image',)))
{
foreach($images as $image) {
$attachmenturl=wp_get_attachment_url($image->ID);
$attachmentimage=wp_get_attachment_image($image->ID, $size);
$img_title = $image->post_title;
$img_desc = $image->post_excerpt;
if ($size != "full"){
echo '<a href="'.$attachmenturl.'" rel="lightbox" title="'.$img_desc.'">'.$attachmentimage.'</a>'.$img_title.'';
} else {
echo '<img src="'.$attachmenturl.'">';
}
}
} else {
echo "No Image";
}
}
?>
をのfunctions.php(私の場合のsingle.phpに)投稿ページにこれを追加するには、これを追加する必要があります自動的に追加されます。
私は以前このプラグインを使用しました。画像ギャラリーとしてはうまくいきますが、ページ/投稿を直接編集しながら画像をアップロードできる必要があります。 – Adam