Styling a page of attachments
-
I’ve succesfully been able to create a Gallery page that displays all of the image attachments which have been uploaded. The page is supposed to be a central gallery of all of the images. This has been achieved by using the example code of get_posts from the Codex.
The problem is that how would you style the output in a neat table? Is there a way to implement gallery shortcode into the get_posts routine?
To which place should I inject styling tags, if I need to?
Here is the code:
<?php $args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => null, // any parent ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $post) { setup_postdata($post); the_attachment_link($post->ID, false); the_excerpt(); } } ?>
That code is a part of the template of the Gallery page. Without any styling the images are displayed below each other.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Styling a page of attachments’ is closed to new replies.