function sb_slideshow_shortcode($atts, $content = NULL) { extract(shortcode_atts(array('id' => 0), $atts)); // get various options stored as post meta records $ssorri = get_post_meta($id, 'ssorri', true); $effect = get_post_meta($id, 'effect', true); $control = get_post_meta($id, 'control', true); if (!$control) { $control = array(); } // so the in_array() below doesn't error out $pause = get_post_meta($id, 'pause', true); $opacity = get_post_meta($id, 'opacity', true); $size = get_post_meta($id, 'size', true); // get the width and height array that corresponds to the chosen slideshow size switch ($size) { case 'max': $dimensions = get_post_meta($id, 'size_max', true); break; case 'custom': $dimensions = get_post_meta($id, 'size_custom', true); break; case 'min': default: $dimensions = get_post_meta($id, 'size_min', true); break; } if ($ssorri == 'slideshow_on') { // get and sort all slides stored as post meta records $slides = get_post_meta($id, 'slide', false); // set single (third parameter) to false to pull ALL records with key "slide" usort($slides, 'sb_slideshow_slide_sort'); // order the elements of the array // add javascript to be output in the footer (safer than outputing in the content area) global $sb_slideshow_footer_javascript, $sb_slideshow_interface; $id = sb_slideshow_verify_id($id); // need to do this to allow for the same slideshow to be embedded multiple times on one page $controlNav = in_array('navigation', $control); $sb_slideshow_footer_javascript .= apply_filters('sb_slideshow_footer_javascript', '$("#slider-' . $id . '").nivoSlider({ effect:"' . ($effect == '' ? 'random' : implode(',', $effect)) . '", pauseTime:' . ($pause == '' ? $sb_slideshow_interface['pause'] : $pause) . ', captionOpacity: ' . ($opacity == '' ? $sb_slideshow_interface['opacity'] : $opacity) . ', directionNav:' . (in_array('arrows', $control) ? 'true' : 'false') . ', controlNav:' . ($controlNav ? 'true' : 'false') . ' });', $id, $effect, $pause, $control, $opacity); // create the code for the slideshow $result = ''; $result .= '<div class="slider-wrapper' . ($controlNav ? ' with-controlNav' : '') . '" style="width:' . $dimensions['width'] . 'px;"> <div class="slider" id="slider-' . $id . '">'; foreach ($slides as $slide) { $attachment = get_post($slide['attachment_id']); $description = $attachment->post_content; if ($attachment->post_excerpt != '') { $result .= '<a href="' . $attachment->post_excerpt . '">'; } $result .= sb_post_image($dimensions['width'], $dimensions['height'], NULL, 1, array('image_id' => $slide['attachment_id'], 'title' => $description, 'alt' => $description, 'echo' => false)); if ($attachment->post_excerpt != '') { $result .= '</a>'; } } $result .= '</div></div>'; return apply_filters('sb_slideshow_result', $result, $id, $dimensions, $control, $slides); // finally, output the resulting code } else { $slides = get_post_meta($id, 'slide', false); //usort($slides, 'sb_slide_sort'); // order the elements of the array $total = count($slides); $random = mt_rand() % $total; $slide = $slides[$random]; $result = ''; $result .= '<div class="slider_wrapper" style="width:' . $dimensions['width'] . 'px">'; $result .= sb_post_image($dimensions['width'], $dimensions['height'], null, 1, array('image_id' => $slide['attachment_id'], 'title' => strip_tags($slide['caption']), 'alt' => strip_tags($slide['caption']), 'echo' => false)); $result .= '<span class="slide_caption">' . $slide['caption'] . '</span>'; $result .= '</div>'; $result .= ''; return $result; } }
function post_image_feeds($content) { global $post; $content = '<div><a href="' . the_permalink() . '" title="' . the_title() . '">' . sb_post_image() . '</a></div>' . $content; return $content; }
function widget($args, $instance) { extract($args); global $post; $title = apply_filters('widget_title', $instance['title']); if ($instance['content_type'] != 'page') { $category = $instance['post_categories']; $orderby = $instance['post_orderby']; $order = $instance['post_order']; $count = $instance['post_count']; $showtitle = $instance['post_showtitle']; if ($showmeta = $instance['post_showmeta']) { $meta = $instance['post_meta']; } if ($showimage = $instance['post_showimage']) { $imagewidth = $instance['post_imagewidth']; $imageheight = $instance['post_imageheight']; $imagealignment = $instance['post_imagealignment']; $imagelocation = $instance['post_imagelocation']; } $content = $limit = $readmore = ''; if ($showcontent = $instance['post_showcontent']) { $content = $instance['post_content']; $limit = $instance['post_limit']; $readmore = $instance['post_readmore']; } $morelink = $moretext = $morelocation = ''; if ($showmore = $instance['post_showmore']) { $morelink = $instance['post_morelink']; $moretext = $instance['post_moretext']; $morelocation = $instance['post_morelocation']; } $morecount = $offset = $include = $exclude = ''; if ($showadvanced = $instance['post_showadvanced']) { $offset = $instance['post_offset']; $exclude = $instance['post_exclude'] ? array($instance['post_exclude']) : ''; $include = $instance['post_include'] ? array($instance['post_include']) : ''; $morecount = $instance['post_morecount']; } } else { $page_id = $instance['page']; $showimage = $instance['page_showimage']; $imagewidth = $instance['page_imagewidth']; $imageheight = $instance['page_imageheight']; $imagealignment = $instance['page_imagealignment']; $imagelocation = $instance['page_imagelocation']; $showcontent = $instance['page_showcontent']; $limit = $instance['page_limit']; $readmore = $instance['page_readmore']; } echo $before_widget; if ($instance['content_type'] != 'page') { if ($title && $instance['content_type'] != 'page') { echo $before_title . $title . $after_title; } if ($showmore && ($morelocation == 'before' || $morelocation == 'before_after')) { echo '<a href="' . $morelink . '" class="more-link">' . $moretext . '</a>'; } $postcount = $count + $morecount; $i = 1; $posts = new WP_query(array('post_type' => $instance['content_type'], 'cat' => $category, 'posts_per_page' => $postcount, 'orderby' => $orderby, 'order' => $order, 'offset' => $offset, 'post__in' => $include, 'post__not_in' => $exclude)); ?> <ul> <?php if ($posts->have_posts()) { while ($posts->have_posts()) { $posts->the_post(); if ($i <= $count) { $i++; ?> <li class="featured-item"> <?php if ($showimage && $imagelocation == 'before') { ?> <a class="featured-image align<?php echo $imagealignment; ?> " href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><?php sb_post_image($imagewidth, $imageheight); ?> </a><?php } ?> <?php if ($showtitle) { ?> <a class="featured-title" href="<?php the_permalink(); ?> " title="<?php printf(__('Permalink to %s', 'startbox'), esc_html(get_the_title(), 1)); ?> " rel="bookmark"><?php the_title(); ?> </a><?php } ?> <?php if ($showmeta) { echo '<div class="featured-meta">' . do_shortcode($meta) . '</div>'; } ?> <?php if ($showimage && $imagelocation == 'after') { ?> <a class="featured-photo align<?php echo $imagealignment; ?> " href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><?php sb_post_image($imagewidth, $imageheight); ?> </a><?php } if ($content != "none") { echo '<div class="featured-content">'; if ($limit) { echo substr(get_the_excerpt(), 0, $limit) . '... '; if ($readmore) { echo '<a href="' . get_permalink() . '" title="' . $readmore . '" rel="bookmark" class="more-link">' . $readmore . '</a>'; } } elseif ($content == "full") { the_content($readmore); } elseif ($content == "excerpt") { the_excerpt(); if ($readmore) { echo '<a href="' . get_permalink() . '" title="' . $readmore . '" rel="bookmark" class="more-link">' . $readmore . '</a>'; } } echo '</div><!-- .featured-contet -->' . "\n"; } ?> </li> <?php } else { ?> <li class="featured-item"> <a class="featured-title" href="<?php the_permalink(); ?> " title="<?php printf(__('Permalink to %s', 'startbox'), esc_html(get_the_title(), 1)); ?> " rel="bookmark"><?php the_title(); ?> </a> </li> <?php } } } ?> </ul> <?php if ($showmore && ($morelocation == 'after' || $morelocation == 'before_after')) { echo '<a href="' . $morelink . '" class="more-link">' . $moretext . '</a>'; } } else { $page = new WP_query('page_id=' . $page_id); ?> <ul> <?php if ($page->have_posts()) { while ($page->have_posts()) { $page->the_post(); ?> <li class="featured-item"> <?php if ($showimage && $imagelocation == 'before') { ?> <a class="featured-image align<?php echo $imagealignment; ?> " href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><?php sb_post_image($imagewidth, $imageheight); ?> </a><?php } ?> <?php $title = !$title ? apply_filters('widget_title', get_the_title()) : $title; echo $before_title . $title . $after_title; ?> <?php if ($showimage && $imagelocation == 'after') { ?> <a class="featured-photo align<?php echo $imagealignment; ?> " href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "><?php sb_post_image($imagewidth, $imageheight); ?> </a><?php } ?> <?php if ($limit) { echo substr(get_the_content(), 0, $limit) . '... '; if ($readmore) { echo '<a href="' . get_permalink() . '" title="' . $readmore . '" rel="bookmark" class="more-link">' . $readmore . '</a>'; } } else { the_content(apply_filters('sb_read_more', $readmore)); } ?> </li> <?php } } ?> </ul> <?php } echo $after_widget; }
</div><!-- .entry-header --> <?php sb_before_post_content(); ?> <div class="entry-content"> <a class="entry-photo" href="<?php the_permalink(); ?> " rel="bookmark" title="<?php the_title(); ?> "> <?php sb_post_image(); ?> </a> <?php if ((is_home() || is_front_page()) && sb_get_option('home_post_content') == 'full' or (!is_home() || !is_front_page()) && sb_get_option('archive_post_content') == 'full') { // Or, If were on an archive page and should display full content the_content(apply_filters("sb_read_more", "Read & Discuss »")); // Display the full content using a filterable read-more tag when necessary } else { // Otherwise, display the excerpt with a fliterable read-more tag the_excerpt(); echo '<a href="' . get_permalink() . '" title="' . sprintf(__("Continue Reading %s", "startbox"), esc_html(get_the_title(), 1)) . '" rel="nofollow" class="more-link">' . apply_filters("sb_read_more", "Read & Discuss »") . '</a>'; } ?>