|
1 <?php get_header(); ?> |
|
2 |
|
3 <?php if(is_active_sidebar(2)) : ?> |
|
4 <?php if (function_exists('dynamic_sidebar') && dynamic_sidebar(2) ); ?> |
|
5 <?php endif; ?> |
|
6 |
|
7 <?php get_sidebar(); ?> |
|
8 |
|
9 <div id="content"> |
|
10 <?php |
|
11 if(get_option("ocmx_home_page_categories") && get_option("ocmx_home_page_categories") !== 0): |
|
12 $use_catid = get_option("ocmx_home_page_categories"); |
|
13 $fetch_category = get_category_by_slug($use_catid); |
|
14 $use_category = "&cat=".$fetch_category->term_id; |
|
15 else : |
|
16 $use_category = ""; |
|
17 endif; |
|
18 $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; |
|
19 query_posts("paged=".$paged.$use_category."&showposts=".get_option("ocmx_home_page_posts")); |
|
20 |
|
21 if (have_posts()) : |
|
22 while (have_posts()) : the_post(); |
|
23 setup_postdata($post); |
|
24 // Fetch the PermaLink, Thumbnail and Video Metas |
|
25 $get_post_video = get_post_meta($post->ID, "main_video", true); |
|
26 $get_thumbnail = get_post_meta($post->ID, "other_media", true); |
|
27 $link = get_permalink($post->ID); |
|
28 // Set our category |
|
29 $category = get_the_category(); |
|
30 // If we haven't used our custom image input, search for the first image in the post |
|
31 $post_image = ""; |
|
32 if($get_thumbnail == "" && (get_option("ocmx_auto_home_images") && get_option("ocmx_auto_home_images") !== "no")) : |
|
33 $post_image = fetch_post_image($post->ID, "560", "2000"); |
|
34 endif; |
|
35 |
|
36 ?> |
|
37 <div class="post"> |
|
38 <div class="post-title"> |
|
39 <h4 class="date"><?php echo date('d M Y', strtotime($post-> post_date)); ?></h4> |
|
40 <h2 class="title"><a href="<?php echo $link; ?>"><?php the_title(); ?></a></h2> |
|
41 </div> |
|
42 <div class="container-header-light-normal"><span></span></div> |
|
43 <div class="copy clearfix"> |
|
44 <?php if($get_post_video !== "") : |
|
45 $get_post_video = preg_replace("/(width\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 560 $2", $get_post_video); |
|
46 $get_post_video = preg_replace("/(height\s*=\s*[\"\'])[0-9]+([\"\'])/i", "$1 312 $2", $get_post_video); |
|
47 ?> |
|
48 <div class="media"> |
|
49 <?php echo $get_post_video; ?> |
|
50 </div> |
|
51 <?php elseif ($post_image !== "") : ?> |
|
52 <div class="media"> |
|
53 <?php echo $post_image; ?> |
|
54 </div> |
|
55 <?php elseif ($get_thumbnail !== "") : ?> |
|
56 <div class="media"> |
|
57 <img src="<?php bloginfo('template_directory'); ?>/functions/timthumb.php?src=<?php echo $get_thumbnail ?>&h=&w=560&zc=1" alt="<?php the_title(); ?>" /> |
|
58 </div> |
|
59 <?php endif; |
|
60 if($post->post_excerpt !== "") : |
|
61 the_excerpt(); |
|
62 else : |
|
63 the_content(); |
|
64 endif; ?> |
|
65 |
|
66 <?php if (comments_open()) : ?> <a href="<?php echo $link;?>#comments" class="post-comments"><?php echo $post->comment_count; ?> Comments</a><?php endif; ?> |
|
67 <a href="<?php echo $link;?>" class="action-link"><span>Continue reading</span></a> |
|
68 </div> |
|
69 <div class="container-footer-light-normal"><span></span></div> |
|
70 </div> |
|
71 <?php |
|
72 endwhile; |
|
73 |
|
74 /* Pagination */ |
|
75 ocmx_pagination(); |
|
76 |
|
77 else: |
|
78 ?> |
|
79 <div class="post"> |
|
80 <h4 class="date">This just happened.</h4> |
|
81 <h2 class="title"><a href="#">Everyone needs to slow down</a></h2> |
|
82 <div class="container-header-light-normal"><span></span></div> |
|
83 <div class="copy clearfix">There are no posts which match your criterea.</div> |
|
84 <div class="container-footer-light-normal"><span></span></div> |
|
85 </div> |
|
86 <?php |
|
87 endif; |
|
88 ?> |
|
89 |
|
90 </div> |
|
91 |
|
92 <?php get_footer(); ?> |