Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* By taking advantage of hooks, filters, and the Custom Loop API, you can make Thesis
- * do ANYTHING you want. For more information, please see the following articles from
- * the Thesis User’s Guide or visit the members-only Thesis Support Forums:
- *
- * Hooks: http://diythemes.com/thesis/rtfm/customizing-with-hooks/
- * Filters: http://diythemes.com/thesis/rtfm/customizing-with-filters/
- * Custom Loop API: http://diythemes.com/thesis/rtfm/custom-loop-api/
- ---:[ place your custom code below this line ]:---*/
- // sticky footer
- function div_push() {
- ?>
- <div class="push"></div>
- <?php
- }
- function div_wrapper_start() {
- ?>
- <div class="wrapper">
- <?php
- }
- function div_wrapper_close() {
- ?>
- </div><!--end wrapper-->
- <?php
- }
- class my_loops extends thesis_custom_loop
- {
- function home()
- {?>
- <p id="fBread"><a href="http://www.magnetmediafilms.com/">Home</a> Our Work</p>
- <div id="diagBar"></div>
- <?php if(is_home() && !is_paged()) { ?>
- <div id="featureditems">
- <h1 id="feat_title">Featured Case Studies</h1>
- <?php
- global $post;
- $args = array( 'numberposts' => '3', 'category' => '59' );
- $myposts = get_posts( $args );
- foreach( $myposts as $post ) : setup_postdata($post); ?>
- <div class="featureditem">
- <a href="<?php the_permalink(); ?>"><div class="feattop">
- <h2><?php echo get_the_title(); ?></h2>
- <?php the_post_thumbnail('featured_thumb'); ?>
- </div></a>
- <div class="excerpt"><?php the_excerpt(); ?></div>
- <p class="more"><a href="<?php the_permalink(); ?>">+ full overview</a></p>
- </div>
- <?php endforeach; ?>
- <h1 id="explore_more">Explore More</h1>
- </div>
- <?php } ?>
- <div id='caseTumbs'>
- <? $tags = array(); $i = 0; ?>
- <?php $page = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>
- <? $args = array( 'posts_per_page' => '16', 'post_type' => 'post', 'cat' => '44, -59', 'paged'=> get_query_var('paged') ); $my_query = new WP_Query($args); ?>
- <? while($my_query->have_posts()): ?>
- <? $my_query->the_post(); $do_not_duplicate = $post->ID; ?>
- <? $_tags = array();$c = '';
- $posttags = get_the_tags();
- if ($posttags)
- {
- foreach($posttags as $tag)
- {
- array_push( $_tags, $tag->name );
- $c .= $tag->slug . ' ';
- }
- }
- $thetags = array_unique( array_merge( $_tags, $tags ) );
- $tags = $thetags;
- $i++; ?>
- <? if ( $i % 4 == 0 ) : ?>
- <a href="<? the_permalink(); ?>" class="caseThumb four <? echo $c; ?>">
- <? else : ?>
- <a href="<? the_permalink(); ?>" class="caseThumb <? echo $c; ?>">
- <? endif; ?>
- <?php if ( has_post_thumbnail() ) { the_post_thumbnail('standard_thumb'); } ?>
- <br><?php echo get_the_title($ID); ?></a>
- <? endwhile; ?>
- </div>
- <? make_dropdown(); ?>
- <script>$(document).ready(function(){if ( $('.caseThumb').length < 16 ) { $('p.previous').hide(); } });</script>
- <?}
- function category()
- {?>
- <p id="fBread"><a href="http://www.magnetmediafilms.com/">Home</a> <a href="http://www.magnetmediafilms.com/casestudies">Our Work</a> <? wp_title("",true); ?></p>
- <div id="diagBar"></div>
- <div id='caseTumbs'>
- <? $i = 0; ?>
- <? if ( have_posts() ): while( have_posts() ) : ?>
- <? the_post(); $i++; ?>
- <? if ( $i % 4 == 0 ) : ?>
- <a href="<? the_permalink(); ?>" class="caseThumb four">
- <? else : ?>
- <a href="<? the_permalink(); ?>" class="caseThumb">
- <? endif; ?>
- <?php if ( has_post_thumbnail() ) { the_post_thumbnail('standard_thumb'); } ?>
- <br><?php echo get_the_title($ID); ?></a>
- <? endwhile; endif; ?>
- </div>
- <? make_dropdown(); ?>
- <?}
- function tag()
- {?>
- <p id="fBread"><a href="http://www.magnetmediafilms.com/">Home</a> <a href="http://www.magnetmediafilms.com/casestudies">Our Work</a> <? wp_title("",true); ?></p>
- <div id="diagBar"></div>
- <div id='caseTumbs'>
- <? $i = 0; ?>
- <? if ( have_posts() ): while( have_posts() ) : ?>
- <? the_post(); $i++; ?>
- <? if ( $i % 4 == 0 ) : ?>
- <a href="<? the_permalink(); ?>" class="caseThumb four">
- <? else : ?>
- <a href="<? the_permalink(); ?>" class="caseThumb">
- <? endif; ?>
- <?php if ( has_post_thumbnail() ) { the_post_thumbnail('standard_thumb'); } ?>
- <br><?php echo get_the_title($ID); ?></a>
- <? endwhile; endif; ?>
- </div>
- <? make_dropdown(); ?>
- <?}
- function single()
- {
- if ( have_posts() )
- {
- while( have_posts() )
- {
- the_post(); ?>
- <p id="fBread"><a href="http://www.magnetmediafilms.com/">Home</a> <a href="http://www.magnetmediafilms.com/casestudies">Our Work</a> <? wp_title("",true); ?></p>
- <div id="diagBar"></div>
- <div id="lCol">
- <div class="upper">
- <? $logo = get_post_meta( get_the_ID(), 'client_logo', true ); ?>
- <? if ( $logo ): ?>
- <img src="<? echo $logo; ?>" />
- <? endif; ?>
- <h6>CLIENT</h6>
- <?php the_tags('<ul><li>','</li><li>','</li></ul>'); ?>
- <!--<p><? #echo get_post_meta( get_the_ID(), 'client_name', true ); ?></p>-->
- <h6>SERVICES</h6>
- <ul>
- <? $cat = get_the_category();
- foreach( $cat as $_cat )
- {
- if ( $_cat->cat_name != "Case Studies" && $_cat->cat_name != "Featured")
- {
- echo "<li><a href='http://www.magnetmediafilms.com/casestudies/category/" . $_cat->slug ."'>" . $_cat->cat_name . "</a></li>";
- }
- } ?>
- </ul>
- <h6>LINKS</h6>
- <ul>
- <?
- $links = get_post_meta( get_the_ID(), 'study_links', true );
- $_l = explode(',', $links);
- foreach( $_l as $__l ) { echo "<li>" . $__l . "</li>"; };
- ?>
- </ul>
- </div>
- <div class="lower">
- <br><br><a href="http://www.magnetmediafilms.com/contact/">Contact us for a quote!</a>
- </div>
- </div>
- <div id="rCol">
- <h2 class="title"><? the_title(); ?></h2>
- <? the_content(); ?>
- </div>
- <? make_dropdown(); ?>
- <?}
- }?>
- <?php
- $cats = get_the_category();
- if ($cats)
- {
- $cat_ids = array();
- foreach($cats as $individual_cat) $cat_ids[] = $individual_cat->term_id;
- $args=array(
- 'category__and' => $cat_ids,
- 'post__not_in' => array(get_the_ID()),
- 'showposts'=> '4',
- 'caller_get_posts' => '1'
- );
- $my_query = new wp_query($args);
- if( $my_query->have_posts() ) {
- echo '<div id="related">';
- while ($my_query->have_posts())
- {
- $my_query->the_post(); ?>
- <a href="<? the_permalink(); ?>" class="caseThumb">
- <?php if ( has_post_thumbnail() ) { the_post_thumbnail('standard_thumb'); } ?>
- <br><?php echo get_the_title($ID); ?></a>
- <? }
- echo '</div>';
- }
- }
- }
- }
- $blah = new my_loops;
- function make_dropdown()
- { ?>
- <div id="tagSelector">
- <select onchange='document.location.href=this.options[this.selectedIndex].value;'>
- <option value="">Select Service</option>
- <option value="http://www.magnetmediafilms.com/casestudies/">View All</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/video-production">Video Production</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/customer-stories">— Customer stories</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/product-videos">— Product Videos</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/branded-series">— Branded Series</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/customer-stories">— Customer stories</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/thought-leadership">— Thought Leadership</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/event-based-videos">— Event-Based Videos</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/social-media-interactive">Social Media & Interactive</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/strategic-consultation">— Strategic Consultation</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/blogs">— Corporate Blog Program</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/socially-enabled-microsites">— Socially Enabled Microsites</option>
- <option value="http://www.magnetmediafilms.com/casestudies/category/social-app-development">— Social App Development</option>
- <?php
- /*$categories= get_categories( array('hide_empty'=>1) );
- foreach ($categories as $category)
- {
- $option = '<option value="http://www.magnetmediafilms.com/casestudies/category/'.$category->category_nicename.'">';
- $option .= $category->cat_name;
- $option .= '</option>';
- echo $option;
- }*/
- ?>
- </select>
- </div>
- <? }
- function previous_text(){
- #$previous = '<span style="font-size: 20px;">«</span> Previous Case Studies';
- $previous = 'Next Case Studies <span style="font-size: 20px;">»</span>';
- return $previous;
- }
- add_filter('thesis_previous','previous_text');
- function next_text(){
- $previous = '<span style="font-size: 20px;">«</span> Previous Case Studies';
- #$previous = 'Next Case Studies <span style="font-size: 20px;">»</span>';
- return $previous;
- }
- add_filter('thesis_next','next_text');
- add_action('thesis_hook_after_content_area', 'div_push');
- add_action('thesis_hook_before_html', 'div_wrapper_start');
- add_action('thesis_hook_after_content_area', 'div_wrapper_close');
- // Feature box slider
- if (function_exists('camera_main_ss_add')) {
- add_action('admin_init','camera_main_ss_add');
- }
- function custom_feature_box(){
- if (function_exists('camera_meta_slideshow'))
- {
- $meta_camera = get_post_custom( get_the_ID() );
- if(isset($meta_camera['camera_meta_slideshow'])){
- if ( is_home() || is_tag() || is_category() || $meta_camera['camera_meta_slideshow'][0] === 'none' )
- {
- echo camera_meta_slideshow('homepage');
- }
- else
- {
- echo camera_meta_slideshow($meta_camera['camera_meta_slideshow'][0]);
- }
- }
- }
- }
- add_action('thesis_hook_feature_box', 'custom_feature_box');
- // Remove sidebars on home page
- function no_sidebars() {
- if (is_home())
- return false;
- else
- return false;
- }
- add_filter('thesis_show_sidebars', 'no_sidebars');
- // Add a custom class to home page for styling
- function home_body_class($classes) {
- if (is_home()) {
- $classes[] .= 'home';
- }
- return $classes;
- }
- add_filter('thesis_body_classes', 'home_body_class');
- add_theme_support('post-thumbnails');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement