Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Press Release Archive
  4. * Description: A duplicate of the standard page template (page.php), which includes
  5. * the media/press sidebar, when that template is used.
  6. *
  7. * @package American Well
  8. */
  9.  
  10. get_header();
  11.  
  12. ?>
  13.  
  14. <div id="primary" class="content-area">
  15. <main id="main" class="site-main" role="main">
  16.  
  17. <?php while ( have_posts() ) : the_post(); ?>
  18.  
  19. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  20.  
  21. <div class="entry-content">
  22. <?php the_content(); ?>
  23.  
  24. <?php foreach ( aw_posts_by_year( 'press_release' ) as $year => $posts ) : ?>
  25. <h2><?php echo esc_html( $year ) ?></h2>
  26. <ul class="yellow-squares">
  27. <?php foreach ( $posts as $post ) : ?>
  28. <?php
  29. // check for alternate urls
  30. $meta = get_post_custom( $post->ID );
  31.  
  32. // check first for local pdf
  33. if ( isset( $meta['press_release_alt_pdf'] ) && is_numeric( $meta['press_release_alt_pdf'][0] ) ) {
  34. $permalink = esc_url( wp_get_attachment_url( absint( $meta['press_release_alt_pdf'][0] ) ) );
  35. } elseif ( isset( $meta['press_release_alt_url'] ) && esc_url( $meta['press_release_alt_url'][0] != '' ) ) {
  36. $permalink = esc_url( $meta['press_release_alt_url'][0] );
  37. } else {
  38. $permalink = esc_url( get_permalink( $post->ID ) );
  39. }
  40.  
  41. ?>
  42.  
  43. <?php printf(
  44. '<li><a href="%s">%s</a><br /> %s</li>',
  45. esc_url( $permalink ),
  46. esc_html( get_the_title( $post->ID ) ),
  47. esc_html( get_the_date( 'F j, Y' , $post->ID ) )
  48. ) ?>
  49. <?php endforeach; ?>
  50. </ul>
  51. <?php endforeach; ?>
  52. </div><!-- .entry-content -->
  53. </article><!-- #post-## -->
  54.  
  55. <aside class="media-contact">
  56. <?php dynamic_sidebar( 'press-sidebar' ); ?>
  57. </aside>
  58.  
  59. <?php endwhile; // end of the loop. ?>
  60.  
  61. </main><!-- #main -->
  62. </div><!-- #primary -->
  63.  
  64. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement