reset($slides); $first_id = key($slides); /** @var SEOSlides_Slide $slide */ $slide = $slides[$first_id]; header("HTTP/1.1 307 Temporary Redirect"); header("Location: " . trailingslashit(trailingslashit(get_permalink()) . $slide->slug)); die; } else { // Get the slide based on its slug $found = get_posts(array('name' => $slide_slug, 'post_type' => 'seoslides-slide', 'post_status' => 'publish', 'numberposts' => 1)); if (count($found) === 0) { SEOSlides_Util::redirect_404(); } $slide = $found[0]; $slide = new SEOSlides_Slide($slide); $slideset_bg = $slide->parent('default_fill_color'); } ?> <!DOCTYPE html> <!--[if IE 7]> <html class="ie ie7" <?php language_attributes(); ?> ><![endif]--> <!--[if IE 8]> <html class="ie ie8" <?php language_attributes(); ?> ><![endif]--> <!--[if !(IE 7) | !(IE 8) ]><!--> <html <?php
/** * Filter the slide permalinks such that they return something useful. * * @since 1.0.3 * * @param string $url Original permalink * @param WP_Post $post Post object * * @return string */ public function slide_permalink($url, $post) { if ('seoslides-slide' !== get_post_type($post)) { return $url; } // Build pretty permalink $slide = new SEOSlides_Slide($post); $url = trailingslashit(get_permalink($slide->parent('ID'))) . $slide->slug . '/'; return $url; }