我正在为我的客户寻找一个简单的图片库。自动在页面画廊wordpress
我需要能够从帖子或页面内上传多张图片,并将图片自动添加到页面中并进行设计。
我能罚这个http://wordpress.org/support/topic/post-image-4
这听起来相似,我正在寻找,但我似乎无法得到它的正常工作。
有谁知道我该怎么做呢?
我正在为我的客户寻找一个简单的图片库。自动在页面画廊wordpress
我需要能够从帖子或页面内上传多张图片,并将图片自动添加到页面中并进行设计。
我能罚这个http://wordpress.org/support/topic/post-image-4
这听起来相似,我正在寻找,但我似乎无法得到它的正常工作。
有谁知道我该怎么做呢?
想通了。
只需要添加这个添加到functions.php
<?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";
}
}
?>
然后将其添加到页面后(在我的情况的single.php)
<?php postimage('thumbnail'); ?>
现在在某个帖子上传任何图片会自动添加。
尝试nextgen gallery :) http://wordpress.org/extend/plugins/nextgen-gallery/
我以前使用过这个插件。它作为一个图像库很好,但我需要能够直接编辑页面/文章的同时上传图像。 – Adam