template-home.php 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /*
  3. * Template Name: Homepage
  4. */
  5. get_header();
  6. ?>
  7. <!-- Jumbotron -->
  8. <div class="container-fluid text-center">
  9. <div class="jumbotron">
  10. <div class="row">
  11. <div class="col-md-10 col-md-offset-1">
  12. <h1><?php _e( 'Hello, my name is Cory Simmons.', 'tuts' ); ?></h1>
  13. <p class="lead">
  14. <?php _e( 'I sell websites and website accessories.', 'tuts' ); ?>
  15. </p>
  16. </div> <!-- end col -->
  17. </div> <!-- end row -->
  18. </div> <!-- end jumbotron -->
  19. </div> <!-- end container-fluid -->
  20. <!-- Filterable Portfolio -->
  21. <div class="filterable-portfolio container-fluid">
  22. <div class="row">
  23. <div class="col-md-12">
  24. <ul class="nav nav-pills portfolio-filter">
  25. <li class="portfolio-title">
  26. <?php _e( 'Filter by:', 'tuts' ); ?>
  27. </li>
  28. <li role="presentation" class="active">
  29. <a href="#" data-filter="*"><?php _e( 'All', 'tuts' ); ?></a>
  30. </li>
  31. <?php
  32. $args = array(
  33. 'orderby' => 'name',
  34. 'order' => 'ASC',
  35. 'hide_empty' => true,
  36. 'exclude' => '1'
  37. );
  38. $categories = get_categories( $args );
  39. foreach ( $categories as $category ) { ?>
  40. <li role="presentation">
  41. <a href="#" data-filter=".<?php echo $category->slug; ?>"><?php echo $category->name; ?></a>
  42. </li>
  43. <?php }
  44. ?>
  45. </ul>
  46. </div> <!-- end col -->
  47. </div> <!-- end row -->
  48. <div class="portfolio-items row">
  49. <?php
  50. $queryArgs = array(
  51. 'cat' => '-1',
  52. 'posts_per_page' => '-1'
  53. );
  54. $query = new WP_Query( $queryArgs );
  55. ?>
  56. <?php if ( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post(); ?>
  57. <?php if ( has_post_thumbnail() ) : ?>
  58. <?php
  59. $slugs = '';
  60. $currentCategories = get_the_category();
  61. foreach ( $currentCategories as $currentCategory ) {
  62. $slugs .= ' ' . $currentCategory->slug;
  63. }
  64. ?>
  65. <figure class="portfolio-item col-sm-4 item<?php echo $slugs; ?>">
  66. <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_post_thumbnail( 'large', array( 'class' => 'img-responsive' ) ); ?></a>
  67. </figure>
  68. <?php endif; ?>
  69. <?php endwhile; ?>
  70. <?php endif; ?>
  71. </div> <!-- end row -->
  72. </div> <!-- end container-fluid -->
  73. <?php
  74. /* Load footer.php */
  75. get_footer();
  76. ?>