开发者

Wordpress jQuery Post Attachment Image Gallery?

Curious if any of you have a good solution for the following situation... because I've never thought of anything myself and usually have to resort to custom fields like "post-image-1" t开发者_运维问答hrough "post-image-10" and manually paste the file name of a jpg in. Which is a horrible solution and only works for tech savvy posters.

Basically I want non-tech savvy users to be able to upload / attach (but not insert into the actual post content) multiple images to a post, which will be turned into a makeshift gallery.

Then I want to output these attachments in a list down the page after the post, using basic jQuery lightbox gallery functionality.

It doesn't have to be through attachments, it could be a stand alone plugin, as long as it offers customizable markup. Basically any solution that would achieve the same thing would be incredible.

Has anyone done this before? Am I missing something terribly obvious? I don't even know what exactly to call this, so I haven't had much luck with my Google research so far :(

Thanks!


You can upload images to the attachment, but not actually insert them into the post, then there are some function so you can call those files.

you can check docs here http://codex.wordpress.org/Function_Reference/get_children

Here's an example

            <div id="slideshow">
            <?php
                $attachments = get_children( array(
                        'post_parent'    => get_the_ID(),
                        'post_type'      => 'attachment',
                        'numberposts'    => 10, // show all -1
                        'post_status'    => 'inherit',
                        'post_mime_type' => 'image',
                        'order'          => 'ASC',
                        'orderby'        => 'menu_order ASC'
                    ));
                unset( $attachments[ get_post_thumbnail_id($p_id) ] );
                foreach ( $attachments as $attachment_id => $attachment ) {
             ?>
                    <img src="<?php echo wp_get_attachment_url($attachment_id);?>" alt="Chevrolet" width="540" height="246" />
            <?php
                }
            ?>

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜