/** * Manipulate the featured image */ function msd_post_image() { global $post; //setup thumbnail image args to be used with genesis_get_image(); $size = 'post-image'; // Change this to whatever add_image_size you want $default_attr = array('class' => "attachment-{$size} {$size}", 'alt' => $post->post_title, 'title' => $post->post_title); // This is the most important part! Checks to see if the post has a Post Thumbnail assigned to it. You can delete the if conditional if you want and assume that there will always be a thumbnail if (has_post_thumbnail() && is_page()) { msdlab_page_banner(); } elseif (has_post_thumbnail() && is_cpt('project')) { if (is_single()) { msdlab_page_banner(); } } elseif (has_post_thumbnail()) { print '<section class="header-image">'; printf('<a title="%s" href="%s">%s</a>', get_permalink(), the_title_attribute('echo=0'), genesis_get_image(array('size' => $size, 'attr' => $default_attr))); print '</section>'; } }
function display_event_info() { global $post, $date_info; if (is_single() && is_cpt($this->cpt)) { $date_info->the_meta($post->ID); if ($date_info->get_the_value('event_start_date') && $date_info->get_the_value('event_end_date')) { if ($date_info->get_the_value('event_start_datestamp') == $date_info->get_the_value('event_end_datestamp')) { $event_date = date("M d, Y", $date_info->get_the_value('event_end_datestamp')); } else { $event_date = date("M d, Y", $date_info->get_the_value('event_start_datestamp')) . ' to ' . date("M d, Y", $date_info->get_the_value('event_end_datestamp')); } } elseif ($date_info->get_the_value('event_start_date')) { $event_date = date("M d, Y", $date_info->get_the_value('event_start_datestamp')); } elseif ($date_info->get_the_value('event_end_date')) { $event_date = date("M d, Y", $date_info->get_the_value('event_end_datestamp')); } else { $event_date = ''; } if ($date_info->get_the_value('event_start_time') != '' && $date_info->get_the_value('event_end_time') != '') { if ($date_info->get_the_value('event_start_time') == $date_info->get_the_value('event_end_time')) { $event_time = $date_info->get_the_value('event_end_time'); } else { $event_time = $date_info->get_the_value('event_start_time') . ' to ' . $date_info->get_the_value('event_end_time'); } } elseif ($date_info->get_the_value('event_start_time') != '') { $event_time = $date_info->get_the_value('event_start_time'); } elseif ($date_info->get_the_value('event_end_time') != '') { $event_time = $date_info->get_the_value('event_end_time'); } else { $event_time = ''; } $venue = $date_info->get_the_value('venue'); $title = $post->post_title; print '<h3>' . $event_date . ' ' . $event_time . '</h3>'; print '<h4>' . $venue . '</h4>'; } }
function make_posts_page_private() { global $post; if ((is_home() || is_cpt('post') && is_single() || is_page() && get_post_status() == 'private') && !is_user_logged_in()) { exit(wp_redirect(home_url('/private'))); } }
function county_data_bio_display() { if (is_cpt('county')) { global $post, $county_data; $county_data->the_meta(); $image_id = get_attachment_id_from_src($county_data->get_the_value('bio_image')); $image = wp_get_attachment_image($image_id, 'biopic'); $bio_name = strlen($county_data->get_the_value('bio_name')) > 0 ? $county_data->get_the_value('bio_name') : '___________'; $ret = '<div id="bio" class="bio"> ' . $image . ' <h3>' . $bio_name . '\'s Story</h3> <div class="story"> ' . $county_data->get_the_value('bio') . ' </div> </div>'; print $ret; } }