PageRenderTime 44ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 1ms

/themes/OneMozilla/index.php

https://github.com/fvignals/One-Mozilla-blog
PHP | 67 lines | 53 code | 13 blank | 1 comment | 11 complexity | b4237cefc943bacb3e7c5d87361e619c MD5 | raw file
  1. <?php get_header(); ?>
  2. <div id="content-main" class="main" role="main">
  3. <?php if ( is_front_page() && ($paged < 1) ) :
  4. /* Set up a custom loop for the three most recent featured posts */
  5. $featured = new WP_Query( array('posts_per_page' => 3, 'meta_key' => '_fc_featuredpost', 'meta_value' => 1) );
  6. if( $featured->have_posts() ) : ?>
  7. <section class="featured-posts">
  8. <h2><?php _e('Featured', 'onemozilla'); ?></h2>
  9. <ul class="hfeed">
  10. <?php while($featured->have_posts()): $featured->the_post(); ?>
  11. <li id="feature-<?php the_ID(); ?>" class="hentry feature">
  12. <h3 class="entry-title entry-summary">
  13. <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permanent link to &ldquo;%s&rdquo;', 'onemozilla' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
  14. <?php if (has_post_thumbnail()) : ?>
  15. <?php the_post_thumbnail(array(150,150), array('alt' => "", 'title' => "")); ?>
  16. <?php else : ?>
  17. <img src="<?php echo get_template_directory_uri(); ?>/img/featured.png" alt="" width="150" height="150" class="wp-post-image">
  18. <?php endif; ?>
  19. <?php the_title(); ?>
  20. </a>
  21. </h3>
  22. </li>
  23. <?php endwhile; ?>
  24. </ul>
  25. </section>
  26. <?php else: endif; ?>
  27. <?php endif; ?>
  28. <?php if ( have_posts() ) : ?>
  29. <?php /* Start the Loop */ ?>
  30. <?php while ( have_posts() ) : the_post(); ?>
  31. <?php get_template_part( 'content', get_post_format() ); ?>
  32. <?php endwhile; ?>
  33. <?php if (fc_show_posts_nav()) : ?>
  34. <nav class="nav-paging">
  35. <ul role="navigation">
  36. <?php if ( $paged < $wp_query->max_num_pages ) : ?><li class="prev"><?php next_posts_link(__('Older posts','onemozilla')); ?></li><?php endif; ?>
  37. <?php if ( $paged > 1 ) : ?><li class="next"><?php previous_posts_link(__('Newer posts','onemozilla')); ?></li><?php endif; ?>
  38. </ul>
  39. </nav>
  40. <?php endif; ?>
  41. <?php else : ?>
  42. <article id="post-0" class="post no-results not-found">
  43. <header class="entry-header">
  44. <h1 class="entry-title"><?php _e( 'Nothing Found', 'onemozilla' ); ?></h1>
  45. </header><!-- .entry-header -->
  46. <div class="entry-content">
  47. <p><?php _e( 'Sorry, we couldn&#8217;t find any results for the requested archive. Perhaps try searching?', 'onemozilla' ); ?></p>
  48. <?php get_search_form(); ?>
  49. </div><!-- .entry-content -->
  50. </article><!-- #post-0 -->
  51. <?php endif; ?>
  52. </div><!-- #content-main -->
  53. <?php get_sidebar(); ?>
  54. <?php get_footer(); ?>