Advertisement
Guest User

custom template

a guest
Feb 12th, 2013
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.65 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: custom home
  4. */
  5. ?>
  6.  
  7.  
  8.  
  9. <?php
  10. $et_ptemplate_settings = array();
  11. $et_ptemplate_settings = maybe_unserialize(get_post_meta($post->ID, 'et_ptemplate_settings', true));
  12.  
  13. $fullwidth = isset($et_ptemplate_settings['et_fullwidthpage']) ? (bool) $et_ptemplate_settings['et_fullwidthpage'] : false;
  14.  
  15. $et_ptemplate_blogstyle = isset($et_ptemplate_settings['et_ptemplate_blogstyle']) ? (bool) $et_ptemplate_settings['et_ptemplate_blogstyle'] : false;
  16.  
  17. $et_ptemplate_showthumb = isset($et_ptemplate_settings['et_ptemplate_showthumb']) ? (bool) $et_ptemplate_settings['et_ptemplate_showthumb'] : false;
  18.  
  19. $blog_cats = isset($et_ptemplate_settings['et_ptemplate_blogcats']) ? (array) $et_ptemplate_settings['et_ptemplate_blogcats'] : array();
  20. $et_ptemplate_blog_perpage = isset($et_ptemplate_settings['et_ptemplate_blog_perpage']) ? (int) $et_ptemplate_settings['et_ptemplate_blog_perpage'] : 10;
  21. ?>
  22.  
  23. <?php get_header(); ?>
  24. <div id="wrap"<?php if ($fullwidth) echo ' class="no_sidebar"'; ?>>
  25. <!-- Main Content-->
  26. <img src="<?php bloginfo('template_directory'); ?>/images/content-top<?php if ($fullwidth) echo ('-full'); ?>.gif" alt="content top" class="content-wrap" />
  27. <div id="content">
  28. <!-- Start Main Window -->
  29.  
  30. <div id="main">
  31. <?php get_template_part('includes/default'); ?>
  32. <?php
  33. $query = new WP_Query(array('orderby' => 'date', 'order' => 'DESC'));
  34.  
  35. if ($query->have_posts()) : while ($query->have_posts()) : $query->the_post();
  36. ?>
  37. <div class="new_post entry clearfix">
  38.  
  39. <div class="postcontent">
  40. <?php
  41. $width = (int) get_option('polished_thumbnail_width_pages');
  42. $height = (int) get_option('polished_thumbnail_height_pages');
  43. $classtext = 'post_img';
  44. $titletext = get_the_title();
  45.  
  46. $thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext);
  47. $thumb = $thumbnail["thumb"];
  48. ?>
  49.  
  50. <?php if ($thumb <> '' && get_option('polished_page_thumbnails') == 'on') { ?>
  51. <?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
  52. <?php }; ?>
  53. <?php the_content(); ?>
  54. <?php wp_link_pages(array('before' => '<p><strong>' . esc_html__('Pages', 'Polished') . ':</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
  55.  
  56. <div id="et_pt_blog">
  57. <?php
  58. $cat_query = '';
  59. if (!empty($blog_cats))
  60. $cat_query = '&cat=' . implode(",", $blog_cats);
  61. else
  62. echo '<!-- blog category is not selected -->';
  63. ?>
  64. <?php
  65. $et_paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
  66. ?>
  67. <?php query_posts("showposts=$et_ptemplate_blog_perpage&paged=" . $et_paged . $cat_query); ?>
  68. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  69.  
  70. <div class="et_pt_blogentry clearfix">
  71. <h2 class="et_pt_title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
  72.  
  73. <p class="et_pt_blogmeta"><?php esc_html_e('Posted', 'Polished'); ?> <?php esc_html_e('by', 'Polished'); ?> <?php the_author_posts_link(); ?> <?php esc_html_e('on', 'Polished'); ?> <?php the_time(get_option('polished_date_format')) ?> <?php esc_html_e('in', 'Polished'); ?> <?php the_category(', ') ?> | <?php comments_popup_link(esc_html__('0 comments', 'Polished'), esc_html__('1 comment', 'Polished'), '% ' . esc_html__('comments', 'Polished')); ?></p>
  74.  
  75. <?php
  76. $thumb = '';
  77. $width = 184;
  78. $height = 184;
  79. $classtext = '';
  80. $titletext = get_the_title();
  81.  
  82. $thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext);
  83. $thumb = $thumbnail["thumb"];
  84. ?>
  85.  
  86. <?php if ($thumb <> '' && !$et_ptemplate_showthumb) { ?>
  87. <div class="et_pt_thumb alignleft">
  88. <?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height, $classtext); ?>
  89. <a href="<?php the_permalink(); ?>"><span class="overlay"></span></a>
  90. </div> <!-- end .thumb -->
  91. <?php }; ?>
  92.  
  93. <?php if (!$et_ptemplate_blogstyle) { ?>
  94. <p><?php truncate_post(550); ?></p>
  95. <a href="<?php the_permalink(); ?>" class="readmore"><span><?php esc_html_e('read more', 'Polished'); ?></span></a>
  96. <?php } else { ?>
  97. <?php
  98. global $more;
  99. $more = 0;
  100. ?>
  101. <?php the_content(); ?>
  102. <?php } ?>
  103. </div> <!-- end .et_pt_blogentry -->
  104.  
  105. <?php endwhile; ?>
  106. <div class="page-nav clearfix">
  107. <?php
  108. if (function_exists('wp_pagenavi')) {
  109. wp_pagenavi();
  110. } else {
  111. ?>
  112. <?php get_template_part('includes/navigation'); ?>
  113. <?php } ?>
  114. </div> <!-- end .entry -->
  115. <?php else : ?>
  116. <?php get_template_part('includes/no-results'); ?>
  117. <?php
  118. endif;
  119. wp_reset_query();
  120. ?>
  121.  
  122. </div> <!-- end #et_pt_blog -->
  123.  
  124. <?php edit_post_link(esc_html__('Edit this page', 'Polished')); ?>
  125. <div class="clear"></div>
  126.  
  127. </div> <!-- end .post -->
  128. </div>
  129. <?php
  130. endwhile;
  131. endif;
  132. wp_reset_postdata();
  133. ?>
  134. </div>
  135. <!-- End Main -->
  136.  
  137. <?php if (!$fullwidth) get_sidebar(); ?>
  138. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement