function ts_heading_title($atts, $content = null) { extract(shortcode_atts(array(), $atts)); $content = ts_remove_autop($content); $output = '<h1 class="title_pattern uppercase"><span>' . $content . '</span></h1>'; return do_shortcode($output); }
function ts_recentposts($atts, $content = null) { extract(shortcode_atts(array("title" => '', "cat" => '', "longchar" => 130), $atts)); $content = ts_remove_autop($content); $output = ''; if ($title != "") { $output .= '<h2 class="title_pattern uppercase"><span>' . $title . '</span></h2>'; } $i = 1; query_posts("showposts=4&category_name=" . $cat); global $post; $output .= '<ul id="recentpost">'; while (have_posts()) { the_post(); if ($i % 4 == 0) { $addclass = "last"; } else { $addclass = ""; } $excerpt = get_the_excerpt(); //get_comment $num_comments = get_comments_number(); // for some reason get_comments_number only returns a numeric value displaying the number of comments if (comments_open()) { if ($num_comments == 0) { $comments = __('No Comments', 'templatesquare'); } elseif ($num_comments > 1) { $comments = $num_comments . __(' Comments', 'templatesquare'); } else { $comments = "1 Comment"; } $write_comments = '<a href="' . get_comments_link() . '">' . $comments . '</a>'; } else { $write_comments = __('Comments off', 'templatesquare'); } //get blog post thumb $custom = get_post_custom($post->ID); $cf_thumb = isset($custom["thumb"][0]) ? $custom["thumb"][0] : ""; if ($cf_thumb != "") { $thumb = '<img src=' . $cf_thumb . ' alt="" width="210" height="158" class="frame"/><span class="shadowimg220"></span>'; } elseif (has_post_thumbnail($post->ID)) { $thumb = get_the_post_thumbnail($post->ID, 'blog-post-thumb', array('alt' => '', 'class' => 'frame')) . '<span class="shadowimg220"></span>'; } else { $thumb = ""; } $output .= '<li class="' . $addclass . '">'; $output .= $thumb; $output .= '<div class="entry-date">' . get_the_time('d/m/y') . ' - ' . $write_comments . '</div>'; $output .= '<h5 class="colortext"><a href="' . get_permalink() . '">' . get_the_title() . '</a></h5>'; $output .= '<span>' . ts_string_limit_char($excerpt, $longchar) . '</span>'; $output .= '</li>'; $i++; $addclass = ""; } wp_reset_query(); $output .= '</ul>'; $output .= '<div class="clear"></div>'; return do_shortcode($output); }
function ts_pdf_link($atts, $content = null) { extract(shortcode_atts(array(), $atts)); $content = ts_remove_autop($content); //$output = '<span class="pdf-link">'.$content.'</span>'; //$output = '<div class="pdf-link-wrapper clearfix"><img src="'.get_template_directory_uri().'/images/cachk/pdf-icon-32.png" class="pdf-link-icon"/><span class="pdf-link">'.$content.'</span></div>'; $output = '<table class="pdf-link-wrapper"><tr><td class="pdf-link-icon"><img src="' . get_template_directory_uri() . '/images/cachk/pdf-icon-32.png"/></td><td class="pdf-link">' . $content . '</td></tr></table>'; return do_shortcode($output); }
function ts_highlight($atts, $content = null) { extract(shortcode_atts(array("color" => ''), $atts)); $content = ts_remove_autop($content); if ($color == "" || $color == "grey") { $output = '<span class="highlight1">' . $content . '</span>'; } if ($color == "black") { $output = '<span class="highlight2">' . $content . '</span>'; } return do_shortcode($output); }
function ts_dropcap($atts, $content = null) { extract(shortcode_atts(array("type" => ''), $atts)); $content = ts_remove_autop($content); if ($type == "circle") { $output = '<span class="dropcap2">' . $content . '</span>'; } elseif ($type == "square") { $output = '<span class="dropcap3">' . $content . '</span>'; } else { $output = '<span class="dropcap1">' . $content . '</span>'; } return do_shortcode($output); }
function ts_imgframe($atts, $content = null) { extract(shortcode_atts(array("size" => '', "path" => '', "align" => ''), $atts)); $content = ts_remove_autop($content); if ($path != "") { if ($size == "x-small") { $output = '<div class="' . $align . '"><img src="' . $path . '" alt="" class="frame" /><span class="shadowimg70"></span></div>'; } elseif ($size == "small") { $output = '<div class="' . $align . '"><img src="' . $path . '" alt="" class="frame" /><span class="shadowimg220"></span></div>'; } elseif ($size == "medium") { $output = '<div class="' . $align . '"><img src="' . $path . '" alt="" class="frame" /><span class="shadowimg300"></span></div>'; } elseif ($size == "large") { $output = '<div class="' . $align . '"><img src="' . $path . '" alt="" class="frame" /><span class="shadowimg610"></span></div>'; } } return do_shortcode($output); }
function ts_portfolio_shortcode($atts, $content = null) { extract(shortcode_atts(array("title" => '', "col" => '', "cat" => '', "showpost" => '4', "showtitle" => '', "showdesc" => '', "moretext" => '', "showseparator" => '', "showpaging" => 'yes', "longdesc" => '200'), $atts)); $content = ts_remove_autop($content); $category = get_term_by('slug', $cat, 'portfoliocat'); $category = $category->term_id; $output = '<div class="pf-shortcode">'; if ($title != "") { $output .= ' <h2 class="title_pattern uppercase"><span>' . $title . '</span></h2>'; } if ($showpaging == "yes") { $paged = get_query_var('paged') ? get_query_var('paged') : 1; $output .= ts_portfolio($col, $category, $showpost, $showtitle, $showdesc, $moretext, $showseparator, $paged, $longdesc); } else { $output .= ts_portfolio($col, $category, $showpost, $showtitle, $showdesc, $moretext, $showseparator, '', $longdesc); } if ($showpaging == "yes") { //Get total of all posts from post type 'portfoliio'. $numposts = ts_portfolio_getnumposts($cat); //Count the total page. $num_page = floor($numposts / $showpost) + 1; $num_page = $numposts % $showpost != 0 ? $num_page : $num_page - 1; if ($num_page > 1) { if (function_exists('wp_pagenavi')) { ob_start(); wp_pagenavi(); $output .= ob_get_contents(); ob_end_clean(); } else { $output .= '<div id="nav-below" class="navigation nav2"> <div class="nav-previous">' . get_next_posts_link(__('<span class="button"><span class="meta-nav">←</span> Prev</span>', 'templatesquare')) . '</div> <div class="nav-next">' . get_previous_posts_link(__('<span class="button">Next <span class="meta-nav">→</span></span>', 'templatesquare')) . '</div> </div><!-- #nav-below -->'; } } } $output .= '</div>'; //end pf-shortcode wp_reset_query(); return do_shortcode($output); }
function ts_tab($atts, $content = null, $code) { extract(shortcode_atts(array('style' => false), $atts)); $content = ts_remove_autop($content); if (!preg_match_all("/(.?)\\[(tab)\\b(.*?)(?:(\\/))?\\](?:(.+?)\\[\\/tab\\])?(.?)/s", $content, $count)) { return do_shortcode($content); } else { for ($i = 0; $i < count($count[0]); $i++) { $count[3][$i] = shortcode_parse_atts($count[3][$i]); } $output = '<ul class="tabs">'; for ($i = 0; $i < count($count[0]); $i++) { $output .= '<li><a href="#tab' . $i . '">' . $count[3][$i]['title'] . '</a></li>'; } $output .= '</ul>'; $output .= '<div id="tab-body">'; for ($i = 0; $i < count($count[0]); $i++) { $output .= '<div id="tab' . $i . '" class="tab-content">' . do_shortcode(trim($count[5][$i])) . '</div>'; } $output .= '</div>'; return '<div class="tabcontainer">' . $output . '</div>'; } }
function ts_separator($atts, $content = null) { extract(shortcode_atts(array("line" => ''), $atts)); $content = ts_remove_autop($content); if ($line == "") { $output = '<div class="separator"></div>'; } else { $output = '<div class="separator line"></div>'; } return do_shortcode($output); }
function ts_clearfixfloat($atts, $content = null) { $content = ts_remove_autop($content); $output = '<div class="clearfix"> </div><br/>'; return do_shortcode($output); }
function ts_blockquote($atts, $content = null) { $content = ts_remove_autop($content); $output = '<blockquote>' . $content . '</blockquote>'; return do_shortcode($output); }
function ts_five_sixth($atts, $content = null) { extract(shortcode_atts(array("class" => ''), $atts)); $content = ts_remove_autop($content); $content = $content; $output = '<div class="five_sixth ' . $class . '">' . $content . '</div>'; return do_shortcode($output); }