function add_shortcode_team_group($atts, $content) { $output = ''; global $add_tabs_script; $add_tabs_script = true; $GLOBALS['member_count'] = 0; do_shortcode($content); if (is_array($GLOBALS['members'])) { foreach ($GLOBALS['members'] as $member) { $members[] = '<div class="member">'; $members[] .= '<div class="picture"><img src="' . theme_resize($member['image'], 300, 0, false) . '" alt="" /></div>'; $members[] .= '<div class="desc">' . $member['content'] . '</div>'; $members[] .= '<div class="clear"></div>'; $members[] .= '</div>'; } $output .= '<div class="team-members">'; $output .= '<div class="ten columns first">'; $output .= do_shortcode(implode("\n", $members)); $output .= '</div>'; $output .= '<div class="nav two columns last">'; $output .= '<div class="up"></div>'; $output .= '<div class="down"></div>'; $output .= '</div>'; $output .= '<div class="clear"></div>'; $output .= '</div>'; } return $output; }
function add_shortcode_clients($atts) { extract(shortcode_atts(array('id' => ''), $atts)); $output = ''; $images = tf_get_gallery_images($id); $output .= '<ul class="partners">'; foreach ($images as $image) { $output .= "<li>"; $output .= "<a title='" . $image['title'] . "'>"; $output .= "<img class='' src='" . theme_resize(get_image_url($image['id']), 145, 60, false) . "'/>"; $output .= "</a>"; $output .= "</li>"; } $output .= '</ul>'; return $output; }
function add_shortcode_image($atts) { extract(shortcode_atts(array('url' => '', 'width' => '500', 'height' => '300', 'align' => 'none', 'lightbox' => 'no', 'link' => '', 'keep_aspect_ratio' => 'yes'), $atts)); $output = ''; if ($link == '') { if ($lightbox == 'yes') { $href = $url; } else { $href = ''; } } else { if ($lightbox == 'yes') { $href = $link; } else { $href = $link; } } if ($lightbox == 'yes') { $lightbox = 'rel="prettyPhoto"'; } if ($lightbox == 'yes' && $link == '') { $link = $url; } if ($align == 'center' || $align == 'none') { $figure_width = 'style="max-width:' . $width . 'px"'; } else { $figure_width = ''; } if ($keep_aspect_ratio == 'yes') { $keep_aspect_ratio = false; } else { $keep_aspect_ratio = true; } $output .= '<figure class="align' . $align . '" ' . $figure_width . '>'; if ($href != '') { $output .= '<a ' . $lightbox . ' href="' . $href . '">'; } $output .= '<img class="scale-with-grid" src="' . theme_resize($url, $width, $height, $keep_aspect_ratio) . '"/>'; if ($href != '') { $output .= '<span class="hover"></span>'; } if ($href != '') { $output .= '</a>'; } $output .= '</figure>'; return $output; }
function tf_get_gallery_post_format($options) { $output = ''; if ($options['height'] == 0 && get_meta_option('pf_slideshow_height') != 0) { $options['height'] = get_meta_option('pf_slideshow_height'); } $output .= '<div class="item-slideshow">'; $output .= '<ul class="slideshow">'; $images = tf_get_gallery_images(get_meta_option('pf_gallery')); foreach ($images as $image) { $output .= '<li>'; $output .= '<img class="scale-with-grid" src="' . theme_resize(get_image_url($image['id']), $options['width'], $options['height'], true) . '">'; $output .= '</li>'; } $output .= '</ul>'; $output .= '</div>'; return $output; }
function add_shortcode_slideshow($atts) { extract(shortcode_atts(array('gallery' => '', 'width' => '400', 'height' => '200', 'align' => 'center'), $atts)); $images = tf_get_gallery_images($gallery); $output = ''; if ($align == 'center' || $align == 'none') { $max_width = 'style="max-width:' . $width . 'px"'; } else { $max_width = ''; } $output .= '<div class="slideshow-wrap align' . $align . '" ' . $max_width . '>'; $output .= "<ul class='slideshow'>"; foreach ($images as $image) { $output .= "<li>"; $output .= "<img class='scale-with-grid' src='" . theme_resize($image['src'], $width, $height, true) . "'/>"; $output .= "</li>"; } $output .= "</ul>"; $output .= "</div>"; return $output; }
function add_shortcode_portfolio_list($atts) { extract(shortcode_atts(array('categories' => '4,5,7', 'style' => 'style1', 'columns' => 'four', 'type' => '', 'items_per_page' => 4, 'exclude' => ''), $atts)); $output = ''; global $add_portfolio_script; $add_portfolio_script = true; if ($categories != '') { $categories = explode(',', $categories); } if ($columns == 'three') { $columns = 'four'; } else { $columns = 'three'; } if ($type == 'sortable') { $items_per_page = -1; } if ($type == 'sortable') { $output .= '<ul id="filter" data-option-key="filter">'; $output .= '<li class="active"><a href="#" data-option-value="*">' . __('All', THEME_SLUG) . '</a></li>'; foreach ($categories as $cat) { $cat = get_term_by('id', $cat, 'portfolio_category'); $output .= '<li><a href="#" data-option-value=".cat-' . $cat->term_id . '">' . $cat->name . '</a></li>'; } $output .= '</ul>'; } $output .= '<div id="portfolio" class="' . $style . ' faded loader">'; $paged = get_query_var('paged') ? get_query_var('paged') : 1; $args = array("post_type" => "portfolio", "post__not_in" => array($exclude), "orderby" => "date", "paged" => $paged, "posts_per_page" => $items_per_page, "tax_query" => array(array("taxonomy" => "portfolio_category", "field" => "id", "terms" => $categories))); query_posts($args); global $wp_query; $pages = $wp_query->max_num_pages; while (have_posts()) { the_post(); $terms = get_the_terms(get_the_id(), 'portfolio_category'); $cats = array(); foreach ($terms as $term) { $cats[] = $term->name; } $cats = join(", ", $cats); $output .= '<div class="item photography video ' . $columns . ' columns ' . implode(get_post_class(), ' ') . '">'; $output .= '<div class="image">'; $output .= '<a href="' . get_permalink() . '">'; $output .= '<img src="' . theme_resize(get_image_url(), 420, 280, true) . '" alt="' . get_the_title() . '" />'; if ($style == 'style2') { $output .= '<span></span>'; } if ($style == 'style1') { $output .= '<span><strong>' . get_the_title() . '<br /><span>' . $cats . '</span></strong></span>'; } $output .= '</a>'; if ($style == 'style2') { $output .= '<h5><a href="' . get_permalink() . '">' . get_the_title() . '</a></h5>'; } $output .= '</div>'; $output .= '</div>'; } $output .= "</div>"; $output .= '<div class="clear"></div>'; if ($type == 'paginated') { $output .= '<hr>'; $output .= '<div class="six columns alpha">'; $output .= tf_pagination(); $output .= '</div>'; $output .= '<div class="align-right six columns omega">'; $output .= '<p>Page ' . $paged . ' of ' . $pages . '</p>'; $output .= '</div>'; $output .= '<div class="clear"></div>'; } wp_reset_query(); wp_reset_postdata(); return $output; }
?> <?php if ($image['url'] != '') { $class = ' href="' . $image['url'] . '"'; } else { $class = ' class="prettyPhoto" href="' . $image['src'] . '"'; } ?> <li><a <?php echo $class; ?> ><img src="<?php echo theme_resize(get_image_url($image['id']), $rg_size, $rg_size, true); ?> "></a></li> <?php } ?> </ul> </div> <script> jQuery(document).ready(function($) {
<?php } else { ?> <?php if ($url != '') { ?> <a href="<?php echo $url; ?> "> <?php } ?> <img class="scale-with-grid" src="<?php echo theme_resize($image['src'], 960, 0, false); ?> " alt="" /> <?php if ($url != '') { ?> </a> <?php } ?> <?php } ?> </li>
function widget($args, $instance) { $cache = wp_cache_get('widget_related_posts', 'widget'); if (!is_array($cache)) { $cache = array(); } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? 'Related Posts' : $instance['title'], $instance, $this->id_base); if (!($number = (int) $instance['number'])) { $number = 3; } else { if ($number < 1) { $number = 1; } else { if ($number > 10) { $number = 10; } } } $type = $instance['type']; global $post; $tags = get_tags($post->ID); if (!$tags) { return; } $tagIDs = array(); for ($i = 0; $i < count($tags); $i++) { $tagIDs[$i] = $tags[$i]->term_id; } $query = array('tag__in' => $tagIDs, 'post__not_in' => array($post->ID), 'posts_per_page' => $number, 'post_status' => 'publish'); if (!empty($instance['cat'])) { $query['cat'] = implode(',', $instance['cat']); } $r = new WP_Query($query); if ($r->have_posts()) { ?> <?php echo $before_widget; ?> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="<?php echo $type; ?> "> <?php while ($r->have_posts()) { $r->the_post(); ?> <?php if ($type == 'type1') { ?> <li> <div class="post-type format-<?php echo get_post_format(); ?> post"><a href="<?php the_permalink(); ?> "></a></div> <div class="post-details"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a><span><?php _e('On', THEME_SLUG); ?> <?php echo get_the_date('d M, Y'); ?> </span></div> </li> <?php } else { ?> <li> <div class="post-image"><img src="<?php echo theme_resize(get_image_url(), 50, 50, true); ?> " alt="<?php the_title(); ?> " /></div> <div class="post-headline"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a><span><?php _e('On', THEME_SLUG); ?> <?php echo get_the_date('d M, Y'); ?> </span></div> </li> <?php } ?> <?php } ?> </ul> <?php echo $after_widget; ?> <?php wp_reset_query(); } $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_related_posts', $cache, 'widget'); }
function widget($args, $instance) { $cache = wp_cache_get('widget_popular_posts', 'widget'); if (!is_array($cache)) { $cache = array(); } if (isset($cache[$args['widget_id']])) { echo $cache[$args['widget_id']]; return; } ob_start(); extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? 'Popular Posts' : $instance['title'], $instance, $this->id_base); if (!($number = (int) $instance['number'])) { $number = 3; } elseif ($number < 1) { $number = 1; } else { if ($number > 10) { $number = 10; } } $type = $instance['type']; $query = array('posts_per_page' => $number, 'nopaging' => 0, 'orderby' => 'comment_count', 'post_status' => 'publish', 'ignore_sticky_posts' => 1); if (!empty($instance['cat'])) { $query['cat'] = implode(',', $instance['cat']); } $r = new WP_Query($query); if ($r->have_posts()) { ?> <?php echo $before_widget; ?> <?php if ($title) { echo $before_title . $title . $after_title; } ?> <ul class="<?php echo $type; ?> "> <?php while ($r->have_posts()) { $r->the_post(); ?> <?php if ($type == 'type1') { ?> <li> <div class="post-type format-<?php echo get_post_format(); ?> post"><a href="<?php the_permalink(); ?> "></a></div> <div class="post-details"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a><span><?php _e('On', THEME_SLUG); ?> <?php echo get_the_date('d M, Y'); ?> </span></div> </li> <?php } else { ?> <li> <div class="post-image"><img src="<?php echo theme_resize(get_image_url(), 50, 50, true); ?> " alt="<?php the_title(); ?> " /></div> <div class="post-headline"><a href="<?php the_permalink(); ?> "><?php the_title(); ?> </a><span><?php _e('On', THEME_SLUG); ?> <?php echo get_the_date('d M, Y'); ?> </span></div> </li> <?php } ?> <?php } ?> </ul> <?php echo $after_widget; ?> <?php wp_reset_query(); } $cache[$args['widget_id']] = ob_get_flush(); wp_cache_set('widget_popular_posts', $cache, 'widget'); }