Advertisement
Guest User

Untitled

a guest
Aug 20th, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.94 KB | None | 0 0
  1. <?php
  2. /**
  3. * The main template file.
  4. *
  5. * This is the most generic template file in a WordPress theme
  6. * and one of the two required files for a theme (the other being style.css).
  7. * It is used to display a page when nothing more specific matches a query.
  8. * E.g., it puts together the home page when no home.php file exists.
  9. *
  10. * @link https://codex.wordpress.org/Template_Hierarchy
  11. *
  12. * @package Flatter
  13. */
  14.  
  15. get_header(); ?>
  16.  
  17. <?php $status=get_theme_mod('slider_category_status');
  18. if($status==0):?>
  19. <header id="myCarousel" class="carousel slide">
  20. <!-- Indicators -->
  21. <ol class="carousel-indicators">
  22. <?php $i = 0; $num=get_theme_mod('slider_category_display_num'); ?>
  23. <?php while($i<=$num) { ?>
  24. <li data-target="#myCarousel" data-slide-to="<?php echo $i;?>" class="<?php if($i==0){echo 'active';}?>"></li>
  25. <?php $i=$i+1;}?>
  26. </ol>
  27.  
  28. <!-- Wrapper for Slides -->
  29. <div class="carousel-inner">
  30. <?php
  31. $cid = get_theme_mod('slider_category_display');
  32. $category_link = get_category_link($cid);
  33. $flatter_cat = get_category($cid);
  34. if ($flatter_cat) {
  35. ?>
  36.  
  37. <?php
  38. global $post;
  39. $cnum=get_theme_mod('slider_category_display_num');
  40. $cnum=$cnum+1;
  41. $args = array(
  42. 'posts_per_page' => $cnum,
  43. 'paged' => 1,
  44. 'cat' => $cid
  45. );
  46. $loop = new WP_Query($args);
  47.  
  48.  
  49. if ($loop->have_posts()) : while ($loop->have_posts()) : $loop->the_post();
  50. ?>
  51.  
  52. <div class="item">
  53. <div class="overlay"></div>
  54. <?php $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'flatter-slider-thumb' ); ?>
  55. <div class="fill" style="background-image: url( <?php if ( has_post_thumbnail() ) {
  56. echo $image[0]; } else { ?>
  57. <?php echo esc_url( get_template_directory_uri());?>/images/slider1.jpg <?php } ?> )">
  58. </div>
  59.  
  60. <div class="carousel-caption outer">
  61. <div class="middle">
  62. <div class="inner wow zoomIn" data-wow-duration="1.5s">
  63. <h3><?php the_title();?></h3>
  64. <?php the_excerpt();?>
  65. <div class="buttons text-center">
  66. <?php if(get_theme_mod('slider_button')) { ?>
  67. <span><a href="<?php echo esc_url(get_theme_mod( 'slider_button', 'http://oceanwebthemes.com' )); ?>" class="btn btn-slider" title=""><?php echo esc_attr(get_theme_mod('slider_contact_title','Contact Us'));?></a></span>
  68. <?php }?>
  69. <span><a href="<?php the_permalink();?>" class="btn btn-slider" title=""><?php _e('Read More','flatter'); ?></a></span>
  70. </div>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <?php
  76. endwhile;
  77. wp_reset_postdata();
  78. endif;
  79. }
  80. ?>
  81. </div>
  82. </header>
  83. <?php else:?>
  84. <?php $status=get_theme_mod('welcome_text_status','1');
  85. if($status==0):?>
  86. <section class="page-header" style="background:#404040 url( <?php if ( get_header_image() ) { header_image(); } ?>)">
  87. <div class="container">
  88. <div class="row">
  89. <div class="col-sm-12">
  90. <div class="block">
  91. <h2 class="page-title" style="color:#<?php echo header_textcolor(); ?>"><?php echo esc_attr(get_theme_mod('welcome_textbox','Welcome to Flatter'));?></h2>
  92. <div class="underline"></div>
  93. <p style="color:#<?php echo header_textcolor(); ?>"><?php echo esc_attr(get_theme_mod('welcome_textarea','Welcome to Flatter'));?></p>
  94. <?php flatter_breadcrumbs(); ?>
  95. </div>
  96. </div>
  97. </div>
  98. </div>
  99. </section>
  100. <?php else:?>
  101. <section class="page-header" style="background:#404040 url( <?php if ( get_header_image() ) { header_image(); } ?>)">
  102. <div class="container">
  103. <div class="row">
  104. <div class="col-sm-12">
  105. <div class="block">
  106. <h2 class="page-title" style="color:#<?php echo header_textcolor(); ?>"><?php _e('Welcome to ','flatter'); echo bloginfo('title'); ?></h2>
  107. <div class="underline"></div>
  108. <?php flatter_breadcrumbs(); ?>
  109. </div>
  110. </div>
  111. </div>
  112. </div>
  113. </section>
  114. <?php endif;?>
  115. <?php endif;?>
  116.  
  117. <section class="inner-content">
  118. <div class="container">
  119. <div class="row">
  120.  
  121. <div class="col-md-9 detail-content">
  122. <?php if ( have_posts() ) : ?>
  123. <div class="masonry-3">
  124. <?php if (! is_front_page() ) : ?>
  125. <header>
  126. <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
  127. </header>
  128. <?php endif; ?>
  129.  
  130.  
  131. <?php /* Start the Loop */ ?>
  132. #!Here <?php while ( have_posts() ) : the_post(); ?>
  133.  
  134. <?php
  135.  
  136. /*
  137. * Include the Post-Format-specific template for the content.
  138. * If you want to override this in a child theme, then include a file
  139. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  140. */
  141. get_template_part( 'template-parts/content', get_post_format() );
  142. ?>
  143.  
  144. <?php endwhile; ?>
  145. </div>
  146.  
  147. <?php flatter_pagination_bars(); ?>
  148.  
  149. <?php else : ?>
  150.  
  151. <?php get_template_part( 'template-parts/content', 'none' ); ?>
  152.  
  153. <?php endif; ?>
  154. </div>
  155.  
  156. <?php get_sidebar('right');?>
  157. </div>
  158. </div>
  159. </section>
  160. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement