?> </head> <body <?php body_class(); ?> > <a href="https://plus.google.com/114713860257080729502" rel="publisher" style="display:inline;"></a> <?php $class = ""; if (is_single() || is_archive()) { global $post; $id = $post->ID; $category = get_primary_category($id); $class = $category->slug; } ?> <div class="navbar-wrapper <?php echo $class; ?> "> <div class="navbar navbar-default navbar-static-top cat-border" id="navbar" role="navigation"> <div class="navbar-header"> <?php $logo = '<img src="' . THEME_DIR . '/images/trc.png" alt="logo"/>'; ?> <a class="navbar-brand" href="<?php echo home_url(); ?>
<?php global $post; ?> <!-- LARGER ISSUES --> <div class="larger-issues"> <ul class="medium-block-grid-3"> <?php foreach ($related_posts as $related_post) { $post = $related_post; setup_postdata($post); $category = get_primary_category($post); ?> <li class="featured-articles-item"> <div class="topics-tag-normal <?php echo $category->slug; ?> "> <a href="<?php echo get_category_link($category->term_id); ?> "><?php echo $category->name; ?> </a> </div> <a href="<?php the_permalink(); ?> ">
?> "><?php echo one_of(simple_fields_fieldgroup('short_title', $prev->ID), get_the_title($prev->ID)); ?> </h3> </div> </a> </div> <?php } ?> <?php if ($next) { $next_category = get_primary_category($next); ?> <div class="arrow-right <?php echo $next_category->slug; ?> show-for-large-up"> <a href="<?php echo post_permalink($next->ID); ?> "> <img src="<?php theme_image_src('arrow-right.svg'); ?> "> <div class="arrow-hover right"> <h3 class="<?php
function spotlight_post() { global $exclude_posts; $id = get_the_ID(); $exclude_posts = array_merge(array($id), $exclude_posts); $title = get_the_title(); $new_title = get_post_meta($id, 'db_featured_title', true); if (!empty($new_title)) { $title = $new_title; } $category = get_primary_category($id); $image_size = array(750, 750); // if($size == "large") { $image_size = array(500,500); } $thumb_id = get_post_thumbnail_id(); $thumb_url = wp_get_attachment_image_src($thumb_id, $image_size, true); $thumb_url = $thumb_url[0]; ?> <div class="post featured <?php echo $category->slug; ?> "> <a href="<?php the_permalink(); ?> "> <div class="featured-image"><div style="background-image:url('<?php echo $thumb_url; ?> ');"></div></div> <?php // if(has_post_thumbnail()) { the_post_thumbnail(array(350,300)); } ?> <h2 class="caption"><?php echo $title; ?> </h2> <div class="spotlight-bg cat-bg-rgba"></div> </a> </div> <?php }
function get_adjacent_posts_from_category($post, $category) { if (!$category) { return null; } $related_posts = get_posts(array('posts_per_page' => -1, 'cat' => $category->term_id)); $index = 0; foreach ($related_posts as $i => $related_post) { if ($related_post->ID == $post->ID) { $index = $i; break; } } $prev = null; $next = null; for ($i = $index - 1; $i >= 0; $i--) { $related_post = $related_posts[$i]; $primary_category = get_primary_category($related_post); if ($primary_category->term_id == $category->term_id) { $prev = $related_post; break; } } for ($i = $index + 1; $i < count($related_posts); $i++) { $related_post = $related_posts[$i]; $primary_category = get_primary_category($related_post); if ($primary_category->term_id == $category->term_id) { $next = $related_post; break; } } return array('prev' => $prev, 'next' => $next); }