Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function path_redirect_newest_menu() {
- $items['media/gallery'] = array(
- 'page callback' => 'path_redirect_newest_gallery',
- 'access callback' => TRUE,
- );
- return $items;
- }
- function path_redirect_newest_gallery() {
- $query = new EntityFieldQuery();
- $query->entityCondition('entity_type', 'node')
- ->entityCondition('bundle', 'gallery_album')
- ->propertyCondition('status', 1)
- ->propertyOrderBy('created', 'DESC')
- ->range(0, 1);
- $result = $query->execute();
- $node = $result['node'];
- reset($node);
- $nid = key($node);
- drupal_goto('node/' . $nid);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement