This repository has been archived on 2026-10-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
nikolark 969c63c752 New style wordpress
This enables automagic updates of WP

- Delete wordpress install
- Move theme(s) to top
- Move local plugins to ./plugins
- Simplify i18n
2017-07-05 01:03:17 +02:00

51 lines
1.1 KiB
PHP

<?php
/*
* Template Name: Recently Updated Image Galleries
*/
$required_number_of_attachments = 3;
$posts = $wpdb->get_col(
$wpdb->prepare(
"SELECT posts.ID FROM $wpdb->posts AS posts
INNER JOIN (
SELECT MAX(post_modified) AS modified, post_parent
FROM $wpdb->posts
WHERE post_type = 'attachment'
AND post_parent > 0
GROUP BY post_parent
HAVING COUNT(ID) >= %d
) AS attachments
ON posts.ID = attachments.post_parent
WHERE posts.post_type = 'event'
ORDER BY attachments.modified DESC",
$required_number_of_attachments
)
);
get_header();
?>
<div id="content" class="container_12">
<h1 class='page-title grid_6 suffix_6'>Nylig oppdaterte bildegallerier</h1>
<?php if ( $posts ) { ?>
<?php
foreach ($posts as $post_id) {
$post = get_post( $post_id );
setup_postdata( $post );
?>
<article class="hentry">
<?php neuf_maybe_display_gallery(); ?>
</article>
<?php } // foreach $posts ?>
<?php } else {
echo "<p>Det fins ingen poster med $required_number_of_attachments eller flere bilder.</p>";
} // end if( $posts) ?>
</div><!-- #content -->
<?php get_footer(); ?>