// Grid Columns function grid_column($atts, $content=null, $shortcodename ="") { extract(shortcode_atts(array( 'class' => '' ), $atts)); //remove wrong nested

$content = remove_invalid_tags($content, array('p')); // add divs to the content $return .= '

'; $return .= do_shortcode($content); $return .= '
'; return $return; } add_shortcode('grid_1', 'grid_column'); add_shortcode('grid_2', 'grid_column'); add_shortcode('grid_3', 'grid_column'); add_shortcode('grid_4', 'grid_column'); add_shortcode('grid_5', 'grid_column'); add_shortcode('grid_6', 'grid_column'); add_shortcode('grid_7', 'grid_column'); add_shortcode('grid_8', 'grid_column'); add_shortcode('grid_9', 'grid_column'); add_shortcode('grid_10', 'grid_column'); add_shortcode('grid_11', 'grid_column'); add_shortcode('grid_12', 'grid_column'); // Fluid Columns function fluid_column($atts, $content=null, $shortcodename ="") { $last = ''; if (isset($atts[0]) && trim($atts[0]) == 'last') $last = 'last'; //remove wrong nested

$content = remove_invalid_tags($content, array('p')); // add divs to the content $return .= '

'; $return .= do_shortcode($content); $return .= '
'; if($last != '') $return .= '
'; return $return; } add_shortcode('one_half', 'fluid_column'); add_shortcode('one_third', 'fluid_column'); add_shortcode('two_third', 'fluid_column'); add_shortcode('one_fourth', 'fluid_column'); add_shortcode('three_fourth', 'fluid_column'); add_shortcode('one_fifth', 'fluid_column'); add_shortcode('two_fifth', 'fluid_column'); add_shortcode('three_fifth', 'fluid_column'); add_shortcode('four_fifth', 'fluid_column'); add_shortcode('one_sixth', 'fluid_column'); add_shortcode('five_sixth', 'fluid_column'); //Recent Posts function shortcode_recent_posts($atts, $content = null) { extract(shortcode_atts(array( 'type' => 'post', 'category' => '', 'custom_category' => '', 'post_format' => 'standard', 'num' => '5', 'meta' => 'true', 'thumb' => 'true', 'thumb_width' => '120', 'thumb_height' => '120', 'more_text_single' => '', 'excerpt_count' => '0', 'custom_class' => '' ), $atts)); $output = ''; return $output; } add_shortcode('recent_posts', 'shortcode_recent_posts'); // Recent Comments function shortcode_recent_comments($atts, $content = null) { extract(shortcode_atts(array( 'num' => '5' ), $atts)); global $wpdb; $sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_author_email, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,50) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) WHERE comment_approved = '1' AND comment_type = '' AND post_password = '' ORDER BY comment_date_gmt DESC LIMIT ".$num; $comments = $wpdb->get_results($sql); $output = ''; return $output; } add_shortcode('recent_comments', 'shortcode_recent_comments'); //Popular Posts function shortcode_popular_posts($atts, $content = null) { extract(shortcode_atts(array( 'num' => '5' ), $atts)); $args = array( 'numberposts' => $num, 'orderby' => 'comment_count', 'order' => 'DESC', 'tax_query' => array( 'relation' => 'AND', array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array('post-format-aside', 'post-format-gallery', 'post-format-link', 'post-format-image', 'post-format-quote', 'post-format-audio', 'post-format-video'), 'operator' => 'NOT IN' ) ) ); $popular = get_posts($args); $output = ''; return $output; } add_shortcode('popular_posts', 'shortcode_popular_posts'); //Recent Testimonials function shortcode_recenttesti($atts, $content = null) { extract(shortcode_atts(array( 'num' => '5', 'thumb' => 'true', 'excerpt_count' => '30' ), $atts)); $testi = get_posts('post_type=testi&orderby=post_date&numberposts='.$num); $output = '
'; global $post; global $my_string_limit_words; foreach($testi as $post){ setup_postdata($post); $excerpt = get_the_excerpt($post->ID); $custom = get_post_custom($post->ID); $testiname = $custom["my_testi_caption"][0]; $testiurl = $custom["my_testi_url"][0]; $testiinfo = $custom["my_testi_info"][0]; $attachment_url = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); $url = $attachment_url['0']; $image = aq_resize($url, 60, 60, true); $output .= '
'; $output .= '
'; if ($thumb == 'true') { if ( has_post_thumbnail($post->ID) ){ $output .= ''; } } $output .= '
'; $output .= '
'; $output .= '
'; if($testiname) { $output .= ''; $output .= $testiname; $output .= '
'; } if($testiinfo) { $output .= ''; $output .= $testiinfo; $output .= '
'; } if($testiurl) { $output .= ''; $output .= $testiurl; $output .= ''; } $output .= '
'; $output .= '
'; } $output .= '
'; return $output; } add_shortcode('recenttesti', 'shortcode_recenttesti'); //Categories function shortcode_list_categories($atts, $content = null) { extract(shortcode_atts(array( 'title' => '', 'orderby' => '', 'order' => '', 'exclude' => '', 'include' => '', 'number' => '', 'hide_empty' => '', 'custom_class' => '' ), $atts)); $categories = get_categories('exclude=' . $exclude . '&include=' . $include . '&number=' . $number . '&orderby=' . $orderby . '&order=' . $order . '&hide_empty=' . $hide_empty); $output = ''; if( !empty($title) || $title != ''){ $output .= '

' . $title . '

'; } $output .= ''; return $output ; } add_shortcode('list_categories', 'shortcode_list_categories'); //Tag Cloud function shortcode_tags($atts, $content = null) { $output = '
'; $tags = wp_tag_cloud('smallest=8&largest=8&format=array'); foreach($tags as $tag){ $output .= $tag.' '; } $output .= '
'; return $output; } add_shortcode('tags', 'shortcode_tags'); // Audio Player function shortcode_audio($atts, $content = null) { extract(shortcode_atts(array( 'file' => '', 'desc' => '' ), $atts)); $template_url = get_template_directory_uri(); $id = mt_rand(); $mp3 = strpos($file, ".mp3"); $output = '