Accordions & Toggles

Accordion Code

/***************** Fancy Media ****************/
function shortcode_fancymedia($atts, $content = null) {
extract(shortcode_atts(array(
“media_type” => ‘type1’,
“enable_lightbox” => ‘yes’,
“align” => ”,
“media_url” => ”,
“media_img” => ”,
“fancyimg_src” => ”,
“image_alt” => ”,
), $atts));

switch ($media_type) {
case ‘type2’ :
$media_type = ‘noframe’;
break;
default :
$media_type = ‘frame’;
break;
break;
}

if($fancyimg_src != NULL) {
$get_fancyimagepath = get_template_directory_uri() . ‘/images/’ . $fancyimg_src;
} else {
$get_fancyimagepath = get_template_directory_uri() . ‘/images/megnor/no_image.jpg’;
}

if($media_img != NULL) {
$get_mediaimagepath = get_template_directory_uri() . ‘/images/’ . $media_img;
} else {
$get_mediaimagepath = get_template_directory_uri() . ‘/images/megnor/no_image.jpg’;
}
$output = ”;
$output .='<div class=”tm_fancymediacontent ‘.$media_type.’ ‘.$align.'”><div class=”fancymedia_inner”>’;

if($media_url != NULL)
{
if($media_img != NULL)
{
$output .= ‘<div class=”media_top”>’;
$output .= ‘<a href=”‘.$media_url.'” title=”The Last Eggtion Hero”><img src=”‘.$get_mediaimagepath.'” alt=”‘.$image_alt.'”/></a></div>’;
$output .= ‘<div class=”media_bottom”>’.do_shortcode($content).'</div>’;
}
else
{
$output .= ‘<div class=”media_top”>’;
$output .= ‘<iframe width=”300″ height=”250″ src=”‘.$media_url.'”></iframe>’;
$output .= ‘</div><div class=”media_bottom”>’.do_shortcode($content).'</div>’;
}

}
else
{
$output .= ‘<div class=”media_top”>’;
if($enable_lightbox == “yes”)
{
$output .= ‘<a href=”‘.$get_fancyimagepath.'” class=”mustang-gallery”><img src=”‘.$get_fancyimagepath.'” alt=”‘.$image_alt.'”/></a>’;
}
else
{
$output .= ‘<img src=”‘.$get_fancyimagepath.'” alt=”‘.$image_alt.'”/>’;
}
$output .= ‘</div><div class=”media_bottom”>’.do_shortcode($content).'</div>’;
}
$output .= ‘</div></div>’;
return $output;
}
add_shortcode(‘tm_fancymedia’, ‘shortcode_fancymedia’);

/***************** Logo ****************/

function shortcode_logo($atts, $content = null) {

extract(shortcode_atts(array(
‘type’ => ‘grid’,
‘items_per_column’ => 5,
‘align’ => ‘left’,
“border_color”=> ‘e6e4dc’,
“border” => ”

), $atts));
$output = ”;
if($border == ‘yes’)
{
$variables .= ‘border-top:1px solid #’.$border_color.’;’;
}
$output .= ‘<div id=”brand-products” class=”tm_logocontent ‘.$align.'”>’;
if($type == ‘slider’):
$output .= ‘<div id=”‘.$items_per_column.’_brand_carousel” class=”brand-carousel tm-logo-content”>’;
else:
$output .= ‘<div id=”‘.$items_per_column.’_brand_grid” class=”brand-grid tm-logo-content”>’;
endif;
$output .=    do_shortcode($content).'</div></div>’;
return $output;
}

add_shortcode(‘tm_logo’, ‘shortcode_logo’);

function shortcode_logoinner($atts, $content = null) {

extract(shortcode_atts(array(
“image” => ”,
“link_url” => ”,
“title” => ‘Logo Image’,
), $atts));

$output = ”;
$output .= ‘<div class=”item brand_main”><div class=”product-block”><a href=”‘.$link_url.'”><img src=”‘.$image.'” alt=”‘.$title.'”/></a></div></div>’;
return $output;
}
add_shortcode(“tm_logoinner”, “shortcode_logoinner”);

/***************** Banner ****************/

function shortcode_banner($atts, $content = null)
{
extract(shortcode_atts(array(
‘backgroung_img’ => ”,
‘link_url’ => ‘#’,
‘title’ => ”,
‘description’ => ”,
‘textalign’ => ”,
‘classname’ => ”
), $atts));

if($backgroung_img != NULL) {
$get_imagepath = $backgroung_img;
} else {
$get_imagepath = get_template_directory_uri() . ‘/images/megnor/no_image.jpg’;
}
$variables=’text-align:’.$textalign.’;’;
$output = ”;
$output .='<div class=”tm_banner column1 ‘.$classname.'” style=”‘.$variables.'”>’;
$output .='<div class=”tm_banner_inner”>’;
$output .='<a href=”‘.$link_url.'” target=”_Blank”>’;
$output .='<img src=”‘.$get_imagepath.'” alt=”” />’;
$output .='</a>’;
$output .='</div>’;
if(!empty($title))
$output .='<div class=”title”>’.$title.'</div>’;
if(!empty($description))
$output .='<div class=”description”>’.$description.'</div>’;
$output .='</div>’;
return $output;
}
add_shortcode(‘tm_banner’, ‘shortcode_banner’);

/***************** Home Sub Banner ****************/

function shortcode_sub_banner($atts, $content = null)
{
extract(shortcode_atts(array(
‘classname’ => ”
), $atts));
$output = ”;
$output .='<div class=”tm_sub_banner ‘.$classname.'”>’;
$output .= do_shortcode($content);
$output .='</div>’;
return $output;
}
add_shortcode(‘tm_sub_banner’, ‘shortcode_sub_banner’);

/***************** Banner slider ****************/

function shortcode_single_slide($atts, $content = null, $code) {
extract(shortcode_atts(array(
‘title’ => ”,
), $atts));

$output = ”;
$output .= ‘<div class=”banner-slider-container”>’;
$output .= ‘<div class=”slider-container-inner”>’;
$output .= ‘<div class=”title”>’.$title.'</div>’;
$output .= ‘<div class=”flexslider”>’;
$output .= ‘<ul class=”slides”>’;
$output .=    do_shortcode($content);
$output .= ‘</ul></div>’;
$output .= ‘</div></div>’;
return $output;
}
add_shortcode(‘slider’, ‘shortcode_single_slide’);

function shortcode_single_slider($atts, $content = null)
{
extract(shortcode_atts(array(
‘image’ => ”,
‘link’ => ”,
‘height’ => ”,
‘width’ => ”,
), $atts));
$output = ”;
$output .= ‘<li><div class=”banner-image”>’;
if(!empty($link)):
$output .= ‘<a target=”_Blank” href=”‘.$link.'”><img src=”‘.$image.'” alt=”” height=”‘.$height.'” width=”‘.$width.'” class=”vv” /></a>’;
else:
$output .= ‘<img src=”‘.$image.'” alt=”” class=”vv” />’;
endif;
$output .= ‘</li></div”>’;
return $output;
}
add_shortcode(‘slide’, ‘shortcode_single_slider’);

/***************** Gallery  ****************/

function shortcode_gallery($attr) {
$post = get_post();
static $instance = 0;
$instance++;

if ( ! empty( $attr[‘ids’] ) ) {
// ‘ids’ is explicitly ordered, unless you specify otherwise.
if ( empty( $attr[‘orderby’] ) )
$attr[‘orderby’] = ‘post__in’;
$attr[‘include’] = $attr[‘ids’];
}

#Allow plugins/themes to override the default gallery template.
$output = apply_filters(‘post_gallery’, ”, $attr);

if ( $output != ” )
return $output;

# We’re trusting author input, so let’s at least make sure it looks like a valid orderby statement
if ( isset( $attr[‘orderby’] ) ) {
$attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] );
if ( !$attr[‘orderby’] )
unset( $attr[‘orderby’] );
}

extract(shortcode_atts(array(
‘type’      => ‘grid’,
‘order’      => ‘ASC’,
‘orderby’    => ‘menu_order ID’,
‘id’         => $post->ID,
‘itemtag’    => ‘dl’,
‘icontag’    => ‘dt’,
‘captiontag’ => ‘dd’,
‘columns’    => 3,
‘size’       => ‘thumbnail’,
‘include’    => ”,
‘exclude’    => ”
), $attr));

$id = intval($id);
if ( ‘RAND’ == $order )
$orderby = ‘none’;

if ( !empty($include) )
{
$_attachments = get_posts( array(‘include’ => $include, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );

$attachments = array();
foreach ( $_attachments as $key => $val ) {
$attachments[$val->ID] = $_attachments[$key];
}
}
elseif ( !empty($exclude) )
{
$attachments = get_children( array(‘post_parent’ => $id, ‘exclude’ => $exclude, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );
}
else
{
$attachments = get_children( array(‘post_parent’ => $id, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );
}

if ( empty($attachments) )
return ”;

if ( is_feed() ) {
$output = “\n”;
foreach ( $attachments as $att_id => $attachment )
$output .= wp_get_attachment_link($att_id, $size, true) . “\n”;
return $output;
}

$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$icontag = tag_escape($icontag);
$valid_tags = wp_kses_allowed_html( ‘post’ );

if ( ! isset( $valid_tags[ $itemtag ] ) )
$itemtag = ‘dl’;
if ( ! isset( $valid_tags[ $captiontag ] ) )
$captiontag = ‘dd’;
if ( ! isset( $valid_tags[ $icontag ] ) )
$icontag = ‘dt’;

$columns = intval($columns);

$selector = “gallery-{$instance}”;

$size_class = sanitize_html_class( $size );

$gallery_div = “<div id=’$selector’ class=’gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}’>”;
$output = apply_filters( ‘gallery_style’, $gallery_style . “\n\t\t” . $gallery_div );

$i = 0;
foreach ( $attachments as $id => $attachment )
{

$link = isset($attr[‘link’]) && ‘file’ == $attr[‘link’] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);

$output = ”;
$output .= “<{$itemtag} class=’gallery-item’>”;
$output .= ”
<{$icontag} class=’gallery-icon’>
$link
</{$icontag}>”;
if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= ”
<{$captiontag} class=’wp-caption-text gallery-caption’>
” . wptexturize($attachment->post_excerpt) . ”
</{$captiontag}>”;
}
$output .= “</{$itemtag}>”;
if ( $columns > 0 && ++$i % $columns == 0 )
$output .= ‘<br style=”clear: both” />’;
}

$output .= ”
<br style=’clear: both;’ />
</div>\n”;

return $output;
}

add_shortcode(‘tm_gallery’, ‘shortcode_gallery’);

/*============ testing ===========*/
function ContactButton($params, $content = null) {

extract(shortcode_atts(array(
‘url’ => ‘/contact-us’,
‘type’ => ‘style1’
), $params));

return
‘<a href=”‘ . $url . ‘” class=”button ‘ . $type. ‘”>’ . ucwords($content) . ‘</a>’;

}
add_shortcode(‘button’,’ContactButton’);

// callout box
function CalloutBox($params, $content = null) {

extract(shortcode_atts(array(
‘type’ => ‘style1’
), $params));

return
‘<div class=”callout ‘ . $type . ‘”>’ . $content . ‘</div>’;

}
add_shortcode(‘callout’,’CalloutBox’);

/***************** Portfolio Filter ****************/

function shortcode_portfolio_filter_container($atts, $content = null, $code) {
global $logotype;
extract(shortcode_atts(array(
‘items_per_column’ => 4
), $atts));

if($items_per_column == ‘1’):
$width = 550;
$height = 550;
$desc_limit = 550;
elseif($items_per_column == ‘2’):
$width = 600;
$height = 600;
$desc_limit = 450;
elseif($items_per_column == ‘3’):
$width = 600;
$height = 600;
$desc_limit = 250;
else:
$width = 600;
$height = 600;
$desc_limit = 80;
endif;
$categories = get_categories(‘hide_empty=0&orderby=name&taxonomy=portfolio_categories’);
$output = ”;
$output .= ‘<div class=”clearfix portfolio-filter-container filter-container”>’;
$output .= ‘<section id=”portfolio_filter_options” class=”options category-container””>’;
$output .= ‘<ul id=”filters” class=”option-set”  data-option-key=”filter”>’;
$output .= ‘<li><a href=”#show-all” data-option-value=”*” class=”selected”>Show All</a></li>’;
foreach ($categories as $category_item ) {
$output .= ‘<li><a href=”#’.$category_item->slug.'” data-option-value=”.’.$category_item->slug.'”>’.$category_item->cat_name.'</a></li>’;
}
$output .= ‘</ul></section>’;
$output .= ‘<div id=”portfolio_filter” class=”portfolio-container portfolios portfolio-filter clearfix da-thumbs portfolio-cols-‘.$items_per_column.'”>’;
foreach ($categories as $category_item ):
$paged = ( isset( $my_query_array[‘paged’] ) && !empty( $my_query_array[‘paged’] ) ) ? $my_query_array[‘paged’] : 1;
$args = array(
‘post_type’ => ‘portfolio’,
‘post_status’ => ‘publish’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘portfolio_categories’,
‘field’ => ‘id’,
‘terms’ => $category_item->term_id,
‘paged’ => $paged
)
)
);
query_posts($args);
while (have_posts()) : the_post();
$image = templatemela_get_first_post_images(get_the_ID());
$src = mr_image_resize($image, $width, $height, true, ‘t’, false);
if( empty ( $src ) || $src == ‘image_not_specified’ ):
$src = get_template_directory_uri().”/images/megnor/placeholder.png”;
$src = mr_image_resize($src, $width, $height, true, $align, false);
endif;
$output .= ‘<div class=”‘.$category_item->slug.’ main item single-portfolio”>’;
$output .= ‘<div class=”image image-block”>’;
$output .= ‘<img src=”‘.$src.'” title=”‘.get_the_title().'” alt=”‘.get_the_title().'” />’;
$output .= ‘<div class=”block_hover”>’;
$output .= ‘<h1 class=”entry-title”>’.get_the_title().'</h1>’;
$output .= ‘<div class=”links”>’;
$output .= ‘<a href=”‘.$image.'” class=”icon mustang-gallery”><i class=”fa fa-search”></i></a>’;
$output .= ‘<a href=”‘.get_permalink().'” class=”icon”><i class=”fa fa-link”></i></a>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
endwhile;
endforeach;
wp_reset_query();
$output .= ‘</div></div>’;
return $output;
}
add_shortcode(‘tm_portfolio_filter’, ‘shortcode_portfolio_filter_container’);

/***************** Portfolio Slider ****************/

function shortcode_portfolio_slider_container($atts, $content = null, $code) {
global $logotype;
extract(shortcode_atts(array(
‘category’ => ”,
‘type’ => ‘slider’,
‘items_per_column’ => 3,
‘number_of_posts’ => 10,
‘layout’ => ‘dark’
), $atts));

if(!empty($category)):
$term_id = $category;
$args = array(
‘post_type’ => ‘portfolio’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => $number_of_posts,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘portfolio_categories’,
‘field’ => ‘id’,
‘terms’ => $term_id
)
)
);
else:
$args = array(
‘post_type’ => ‘portfolio’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => “‘”.$number_of_posts.”‘”
);
endif;
$array_posts = query_posts($args);
$count = count($array_posts);
$output = ”;
if($count > 0):
$output .= ‘<div class=”portfolio-container”>’;
if($type == ‘slider’):
if($count > $items_per_column)
$output .= ‘<div id=”‘.$items_per_column.’_portfolio_carousel” class=”portfolio-carousel”>’;
else
$output .= ‘<div id=”‘.$items_per_column.’_portfolio_grid” class=”portfolio-grid”>’;
else:
$output .= ‘<div id=”‘.$items_per_column.’_portfolio_grid” class=”portfolio-grid”>’;
endif;
$i = 1;
while (have_posts()) : the_post();
if($i % $items_per_column == 1 )
$class = “first”;
elseif($i % $items_per_column == 0 )
$class = “last”;
else
$class = “”;
if($items_per_column == ‘1’):
$width = 550;
$height = 550;
elseif($items_per_column == ‘2’):
$width = 450;
$height = 450;
elseif($items_per_column == ‘3’):
$width = 300;
$height = 300;
else:
$width = 250;
$height = 250;
endif;
$image = templatemela_get_first_post_images(get_the_ID());
$image_src = mr_image_resize($image, $width, $height, true, ‘t’, false);
if(empty($image_src))
$image_src = get_template_directory_uri().”/images/megnor/placeholder.png”;
$output .= ‘<div class=”item portfolio-main”>’;
$output .= ‘<div class=”product-block single-portfolio ‘.$class.’ ‘.$layout.'”>’;
$output .= ‘<div class=”portfolio-image”>’;
$output .= ‘<div class=”portfolio-image_inner”>’;
$output .= ‘<img src=”‘.$image_src.'” title=”‘.get_the_title().'” alt=”‘.get_the_title().'” />’;
$output .= ‘<div class=”other-box”>’;
$output .= ‘<div class=”links”>’;
$output .= ‘<a href=”‘.$image.'” title=”Click to view Full Image” class=”icon mustang-gallery”><i class=”fa fa-search”></i></a>’;
$output .= ‘<a href=”‘.get_permalink().'” title=”Click to view Read More” class=”icon”><i class=”fa fa-link”></i></a>’;
$output .= ‘</div></div>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
$output .= ‘<div class=”portfolio-title”><a href=”‘.get_permalink().'”>’.get_the_title().'</div></a>’;
$output .= ‘<div class=”portfolio-description”>’.templatemela_portfolio_excerpt(100).'</div>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
$i++;
endwhile;
$output .= ‘</div>’;
wp_reset_query();
$output .= ‘</div>’;
else:
$output .= ‘<div class=”no-result”>No results found…</div>’;
endif;
return $output;
}
add_shortcode(‘tm_portfolio_slider’, ‘shortcode_portfolio_slider_container’);

/*============ Portfolio ===========*/

function shortcode_portfolio($atts, $content = null, $code) {
extract(shortcode_atts(array(
‘column’ => 4,
‘cat’ => ”,
‘max’ => ’12’
), $atts));

$output = ”;
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$terms = array();
if ($cat != ”) {
$cat = preg_replace(‘/\s*,\s*/’, ‘,’, $cat);
foreach(explode(‘,’, $cat) as $term_name) {
$terms[] = get_term_by(‘name’, $term_name, ‘portfolio_categories’);
}
foreach($terms as $term) {
$term_ids[] = $term->term_id;
}
$args = array(
‘posts_per_page’ => $max,
‘paged’ => $paged,
‘post_type’ => ‘portfolio’,
‘post_status’ => ‘publish’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘portfolio_categories’,
‘field’ => ‘id’,
‘terms’ => $term_ids
)
)
);
} else {
$args = array(
‘posts_per_page’ => $max,
‘paged’ => $paged,
‘post_type’ => ‘portfolio’,
‘post_status’ => ‘publish’
);
}
query_posts($args);
if($column == 1){
$width = 1200;
$excerpt_length = 180;
$column = 1;
}else if($column == 2){
$width = 600;
$excerpt_length = 180;
$column = 2;
}else if($column == 3){
$width = 400;
$excerpt_length = 120;
$column = 3;
}else if($column == 4){
$width = 300;
$excerpt_length =80;
$column = 4;
}else {
$width = 300;
$column = 4;
}

$output = ‘<div class=”portfolios”>’;
$output .= ‘<ul class=”portfolio_’.$column.’column da-thumbs”>’;
$num_layout =  substr($column, 0, 1);
$i = 1;
while(have_posts()) {
the_post();
$terms = get_the_terms(get_the_ID(), ‘portfolio_categories’);
if ( strlen( $img = get_the_post_thumbnail( get_the_ID()) ) ):
$image = wp_get_attachment_url( get_post_thumbnail_id(get_the_ID()) );
else:
$image = templatemela_get_first_post_images(get_the_ID());
endif;
$src = mr_image_resize($image, $width, $width, true, ‘left’, false);
if( empty ( $src ) || $src == ‘image_not_specified’ ):
$src = get_template_directory_uri().”/images/megnor/placeholder.png”;
$image = $src;
$src = mr_image_resize($src, $width, $width, true, ‘left’, false);
endif;
?>
<?php $terms_slug = array();
if (is_array($terms)) {
foreach($terms as $term) {
$terms_slug[] = $term->slug;
}
}
if($i % $num_layout == 0)
$li_class = “last”;
else if($i % $num_layout == 1)
$li_class = “first”;
else
$li_class = “inner”;
$output .= ‘<li class=”‘.$li_class.'”>’;
$more = get_post_meta(get_the_ID(), ‘_more’, true);
$output .= ‘<div class=”main”><div class=”image-block”>’;
if(get_option(‘portfolio’,’display_image’) || $column == 1):
$output .= ‘<a href= “‘.$image.'” class=”mustang-gallery”>’;
$output .= ‘<img class=”image1″ src=”‘.$src.'”/ >’;
$output .= ‘</a>’;
endif;
$output .= ‘<div class=”other-box”>’;
$output .= ‘<div class=”links”>’;
$output .= ‘<a href=”‘.$image.'” title=”Click to view Full Image” class=”icon mustang-gallery”><i class=”fa fa-search”></i></a>’;
$output .= ‘<a href=”‘.get_permalink().'” title=”Click to view Read More” class=”icon”><i class=”fa fa-link”></i></a>’;
$output .= ‘</div></div>’;
$output .= ‘</div>’;
$output .= ‘<h5><a href=”‘.get_permalink().'”>’.get_the_title().'</a></h5>’;
$output .=  templatemela_portfolio_excerpt($excerpt_length);
$output .= ‘</li>’;
$i++;
}
$output .= ‘</ul>’;
$output .= templatemela_shortcode_paging_nav();
$output .= ‘</div>’;
wp_reset_query();
return $output;
}

add_shortcode(‘tm_portfolio’, ‘shortcode_portfolio’);

/*============ Faqs ===========*/
function shortcode_faqs($atts, $content = null, $code) {
extract(shortcode_atts(array(
‘style’ => ‘1’,
‘category’ => ”
), $atts));
$output = ”;
$output .= ‘<div class=”faqs-container”>’;
$output .= ‘<div class=”faqs-content style-‘.$style.'”>’;

if(!empty($category)):
$term_id = $category;
$args = array(
‘post_type’ => ‘faq’,
‘post_status’ => ‘publish’,
‘posts_per_page’ => ’50’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘faq_categories’,
‘field’ => ‘id’,
‘terms’ => $term_id
)
)
);
query_posts($args);
$term = get_term( $term_id, ‘faq_categories’ );
$output .= ‘<h1 class=”small-title”>’.$term->name.'</h1>’;
$output .= ‘<div class=”faqs-category-container”>’;
while (have_posts()) : the_post();
if($style == ‘1’):
$output .= ‘<div class=”single-faq toogle_div”>’;
$output .= ‘<a class=”tog” href=”#”><span class=”faq_title”>’. get_the_title() .’ </span></a>’;
$output .= ‘<div class=”tab_content”>’.get_the_content().'</div>’;
$output .= ‘</div>’;
endif;
if($style == ‘2’):
$output .= ‘<div class=”single-faq”>’;
$output .= ‘<div class=”title”>’.get_the_title().'</div>’;
$output .= ‘<div class=”content”>’.get_the_content().'</div>’;
$output .= ‘</div>’;
endif;
endwhile;
$output .= ‘</div>’;
else:
$categories = get_categories(‘hide_empty=0&orderby=name&taxonomy=faq_categories’);
foreach ($categories as $category_item ) {
$args = array(
‘post_type’ => ‘faq’,
‘post_status’ => ‘publish’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘faq_categories’,
‘field’ => ‘id’,
‘terms’ => $category_item->term_id
)
)
);
query_posts($args);
$output .= ‘<h1 class=”small-title”>’.$category_item->name.'</h1>’;
$output .= ‘<div class=”faqs-category-container”>’;
while (have_posts()) : the_post();
if($style == ‘1’):
$output .= ‘<div class=”single-faq toogle_div”>’;
$output .= ‘<div class=”title”><a class=”tog” href=”#”> <span class=”cp_plus”> <span class=”vert_line”></span> <span class=”horiz_line”></span> </span> <span class=”faq_title”>’. get_the_title() .’ </span></a></div>’;
$output .= ‘<div class=”tab_content”>’.get_the_content().'</div>’;
$output .= ‘</div>’;
endif;
if($style == ‘2’):
$output .= ‘<div class=”single-faq”>’;
$output .= ‘<div class=”title”>’.get_the_title().'</div>’;
$output .= ‘<div class=”content”>’.get_the_content().'</div>’;
$output .= ‘</div>’;
endif;
endwhile;
$output .= ‘</div>’;
}
endif;
$output .= ‘</div>’;
$output .= ‘</div>’;
wp_reset_query();
return $output;
}
add_shortcode(‘faqs’, ‘shortcode_faqs’);

function shortcode_single_static_link($atts, $content = null) {

extract(shortcode_atts(array(
“link” => ”,
“title” => ”,
), $atts));

$output = ”;
$output .= ‘<div class=”single-link”><a href=”‘.$link.'”>’.$title.'</a></div>’;
return $output;
}
add_shortcode(“single_link”, “shortcode_single_static_link”);

/********************Title***************/
function shortcode_title($atts, $content = null) {

extract(shortcode_atts(array(
‘size’ => ‘big’,
‘type’ => ‘simple’,
‘color’ => ”,
‘align’ => ”,
‘classname’ => ”
), $atts));

$output = ”;
$output .= ‘<div class=”shortcode-title ‘.$align.’ ‘.$classname.'”>’;

if(!empty($color))
$output .= ‘<h1 class=”‘.$type.’-type ‘.$size.’-title” style=”color:#’.$color.’;”>’.do_shortcode($content).'</h1>’;
else
$output .= ‘<h1 class=”‘.$type.’-type ‘.$size.’-title”>’.do_shortcode($content).'</h1>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(“title”, “shortcode_title”);

function shortcode_our_features($atts, $content = null) {
extract(shortcode_atts(array(
“icon” => ”,
“title” => ”,
“read_more_text” => ‘Read More’,
“read_more_link” => ”,
), $atts));

$output = ”;
$output .= ‘<div class=”feature-container”>’;
$output .= ‘<div class=”feature-content”>’;
if(!empty($icon))
$output .= ‘<div class=”icon”><i class=”‘.$icon.'”></i></div>’;
if(!empty($title))
$output .= ‘<div class=”title”>’.$title.'</div>’;
$output .= ‘<div class=”description”>’.do_shortcode($content).'</div>’;
if(!empty($read_more_link))
$output .= ‘<a herf=”‘.$read_more_link.'” class=”other-read-more”>’.$read_more_text.'</a>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(“feature”, “shortcode_our_features”);

/***************** Features ****************/

function shortcode_about($atts, $content = null)
{
extract(shortcode_atts(array(
‘title’ => ”,
‘link_text’ => ‘Read More’,
‘link_url’ => ‘#’,
‘image’ => ”,
‘image_align’ => ‘right’,
‘title_margin’ => ’20px 0 30px’
), $atts));

$output = ”;
$output .='<div class=”tm_about”>’;
$output .='<div class=”tm_about_inner image-‘.$image_align.'”>’;
if(!empty($image)):
$output .='<div class=”about_image one_half”>’;
$output .='<img src=”‘.$image.'” alt=”” />’;
$output .='</div>’;
endif;
if(!empty($image))
$output .='<div class=”about_content one_half”>’;
else
$output .='<div class=”about_content”>’;
$output .='<h3 class=”title” style=”margin:’.$title_margin.'”>’.$title.'</h3>’;
$output .='<div class=”description”>’.do_shortcode($content).'</div>’;
$output .='<div class=”readmore”><a href=”‘.$link_url.'” title=”‘.$link_text.'”>’.$link_text.'<i class=”fa fa-arrow-right”></i></a></div>’;
$output .='</div>’;
$output .='</div></div>’;
return $output;
}
add_shortcode(‘tm_about’, ‘shortcode_about’);

/***************** Overlap images ****************/

function shortcode_overlap_images($atts, $content = null)
{
extract(shortcode_atts(array(
), $atts));

$output = ”;
$output .='<div class=”tm_overlap_images”>’;
$output .='<div class=”tm_overlap_images_inner”>’;
$output .='<ul class=”images”>’;
$output .= do_shortcode($content);
$output .='</ul>’;
$output .='</div></div>’;
return $output;
}
add_shortcode(‘tm_overlap_images’, ‘shortcode_overlap_images’);

function shortcode_overlap_image($atts, $content = null)
{
extract(shortcode_atts(array(
‘image’ => ”,
‘link_url’ => ”,
‘margin’ => ‘0’,
‘textalign’ => ”
), $atts));
$output = ”;
$variables = ”;

$variables .= ‘margin:’.$margin.’;’;
$variables .= ‘text-align:’.$textalign.’;’;
$output .='<li class=”banner” style=”‘.$variables.’;”><a href=”‘.$link_url.'” target=”_blank”><img class=”animated” data-animated=”fadeInLeft” src=”‘.$image.'” alt=””/><span class=”hover_glass”> </span> </a></li>’;
return $output;
}
add_shortcode(“tm_single_image”, “shortcode_overlap_image”);

/***************** Services ****************/

function shortcode_home_services($atts, $content = null) {
extract(shortcode_atts(array(
“color” => ‘464E55’,
“icon_background_color” => ”,
“icon” => ‘fa-arrows-alt’,
“title” => ”,
“link_text” => ”,
“link_url” => ”,
“style” => ‘1’
), $atts));

$style_css = ‘color:#’.$color.’;’;
if(!empty($icon_background_color)):
$style_css .= ‘background-color: #’.$icon_background_color.’;’;
$icon_class = ”;
else:
$icon_class = ‘ no-background’;
endif;

$output = ”;
$output .= ‘<div class=”service hb-animate-element bottom-to-top style-‘.$style.'”>’;
$output .= ‘<div class=”service-content style-‘.$style.'”>’;

if($style == ‘1’ || $style == ‘2’):
if(!empty($icon))
$output .= ‘<div class=”icon”><i class=”service-icon fa ‘.$icon.$icon_class.'” style=”‘.$style_css.'”></i></div>’;
$output .= ‘<div class=”service-content”>’;
if(!empty($title))
$output .= ‘<div class=”title service-text”>’.$title.'</div>’;
endif;

if($style == ‘3’):
$output .= ‘<div class=”service-top”>’;
if(!empty($icon))
$output .= ‘<div class=”icon”><i class=”service-icon fa ‘.$icon.$icon_class.'” style=”‘.$style_css.'”></i></div>’;
if(!empty($title))
$output .= ‘<div class=”title service-text”>’.$title.'</div>’;
$output .= ‘</div>’;
$output .= ‘<div class=”service-content”>’;
endif;

if($style == ‘4’):
if(!empty($title))
$output .= ‘<div class=”title service-text”>’.$title.'</div>’;
if(!empty($icon))
$output .= ‘<div class=”icon”><i class=”service-icon fa ‘.$icon.$icon_class.'” style=”color:#’.$color.’;background-color: #’.$icon_background_color.’;”></i></div>’;
$output .= ‘<div class=”service-content”>’;
endif;

$output .= ‘<div class=”description other-font”>’.do_shortcode($content).'</div>’;

if(!empty($link_text)):
if(!empty($link_url)):
$output .= ‘<div class=”service-read-more other-font”><a herf=”‘.$link_url.'” class=”other-read-more”>’.$link_text.'<i class=”fa fa-arrow-right”></i></a></div>’;
else:
$output .= ‘<div class=”service-read-more other-font”>’.$link_text.’></div>’;
endif;
endif;

$output .= ‘</div>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(“service”, “shortcode_home_services”);

/***************** Code ****************/

function shortcode_code($atts, $content = null) {

extract(shortcode_atts(array(
‘style’    => ‘1’
), $atts));

$output = ”;
$output .= ‘<div class=”code”>’;
$output .=    do_shortcode($content);
$output .=    ‘</div>’;
return $output;
}
add_shortcode(‘tm_code’, ‘shortcode_code’);
/*============ Container ===========*/
function shortcode_container($atts, $content = null){
extract(shortcode_atts(array(
‘background_color’ => ”,
‘background_image’ => ”,
‘background_repeat’ => ‘no-repeat’,
‘background_attachment’ => ‘fixed’,
‘parallex’ => true,
‘background_size’ => ‘cover’,
‘padding’ => ‘0’,
‘margin’ => ‘0’,
‘align’=> ”,
‘color’=> ”,
‘border_color’=> ”,
‘classname’=>”,
‘overflow’=>’hidden’
), $atts));

$variables  = ”;
if(!empty($background_color))
$variables .= ‘background-color: #’.$background_color.’;’;
$variables .= ‘padding:’.$padding.’;’;
$variables .= ‘margin:’.$margin.’;’;
$variables .= ‘border-top:1px solid #’.$border_color.’;’;
if(!empty($color))
$variables .= ‘color:#’.$color.’;’;
$variables .= ‘overflow:’.$overflow.’;’;
if(!empty($background_image)):
$variables .= ‘background-image: url(‘.$background_image.’);’;
$variables .= ‘background-repeat:’.$background_repeat.’;’;
$variables .= ‘background-size:’.$background_size.’;’;
$variables .= ‘background-attachment:’.$background_attachment.’;’;
endif;
$output = ”;
$output .= ‘<div class=”main-container ‘.$align.’ ‘.$classname.'” style=”‘.$variables.’);”>’;
$output .= ‘<div class=”inner-container”>’;
$output .=    do_shortcode($content);
$output .= ‘</div></div>’;
return $output;
}
add_shortcode(‘container’, ‘shortcode_container’);

/*============ One half ===========*/
function shortcode_one_half($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”one_half”>’;
$output .= ‘<div class=”one_half_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘one_half’, ‘shortcode_one_half’);

/*============ Inner One half ===========*/
function shortcode_inner_one_half($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”one_half”>’;
$output .= ‘<div class=”one_half_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘inner_one_half’, ‘shortcode_inner_one_half’);

/*============ One third ===========*/
function shortcode_one_third($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’,
‘padding’ => ”,
‘classname’=> ”
), $atts));

$output = ”;
$output .= ‘<div class=”one_third ‘.$classname.'”>’;
$output .= ‘<div class=”one_third_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;padding:’.$padding.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘one_third’, ‘shortcode_one_third’);

/*============ One fourth ===========*/
function shortcode_one_fourth($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”one_fourth”>’;
$output .= ‘<div class=”one_fourth_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘one_fourth’, ‘shortcode_one_fourth’);

/*============ One Fifth ===========*/
function shortcode_one_fifth($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”one_fifth”>’;
$output .= ‘<div class=”one_fifth_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘one_fifth’, ‘shortcode_one_fifth’);

/*============ One sixth ===========*/
function shortcode_one_sixth($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”one_sixth”>’;
$output .= ‘<div class=”one_sixth_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘one_sixth’, ‘shortcode_one_sixth’);

/*============ Two third ===========*/
function shortcode_two_third($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”two_third”>’;
$output .= ‘<div class=”two_third_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘two_third’, ‘shortcode_two_third’);

/*============ Two Fifth ===========*/
function shortcode_two_fifth($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”two_fifth”>’;
$output .= ‘<div class=”two_fifth_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘two_fifth’, ‘shortcode_two_fifth’);

/*============ Three Fourth ===========*/
function shortcode_three_fourth($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”three_fourth”>’;
$output .= ‘<div class=”three_fourth_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘three_fourth’, ‘shortcode_three_fourth’);

/*============ Three Fifth ===========*/
function shortcode_three_fifth($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”three_fifth”>’;
$output .= ‘<div class=”three_fifth_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘three_fifth’, ‘shortcode_three_fifth’);

/*============ Four Fifth ===========*/
function shortcode_four_fifth($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”four_fifth”>’;
$output .= ‘<div class=”four_fifth_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘four_fifth’, ‘shortcode_four_fifth’);

/*============ Four Fifth ===========*/
function shortcode_five_sixth($atts, $content = null){
extract(shortcode_atts(array(
‘content_width’ => ‘100%’,
‘margin’ => ‘0’,
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”five_sixth”>’;
$output .= ‘<div class=”five_sixth_inner content_inner ‘.$align.'” style=”margin:’.$margin.’;width:’.$content_width.’;”>’;
$output .=    do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘five_sixth’, ‘shortcode_five_sixth’);

/***************** Static Text ****************/

function shortcode_static_text($atts, $content = null){
extract(shortcode_atts(array(
‘align’ => ‘left’
), $atts));

$output = ”;
$output .= ‘<div class=”static-text-container ‘.$align.'”>’;
$output .= ‘<div class=”text”>’.do_shortcode($content).'</div>’;
$output .= ‘</div>’;
return $output;
}

add_shortcode(‘text’, ‘shortcode_static_text’);

/***************** Blog Posts ****************/
function shortcode_blog_posts_container($atts, $content = null, $code) {
extract(shortcode_atts(array(
‘type’ => ‘grid’,
‘items_per_column’ => 3,
‘number_of_posts’ => 10,
‘category’ => ”
), $atts));

$i = 1;
$post =””;
wp_reset_postdata();
$args = array(
‘post_type’ => ‘post’,
‘tax_query’ => array(
array(
‘taxonomy’ => ‘post_format’,
‘field’ => ‘slug’,
‘terms’ => array( ‘post-format-link’, ‘post-format-image’, ‘post-format-quote’, ‘post-format-gallery’,’post-format-audio’,’post-format-video’,’post-format-status’,’post-format-chat’,’post-format-aside’ ),
‘operator’ => ‘NOT IN’
)
),
‘posts_per_page’ => $number_of_posts,
‘post_status’ => ‘publish’,
‘category_name’ => $category,
‘orderby’ => ‘date’
);
$output = ”;
$blog_array = new WP_Query( $args );
$count = $blog_array->post_count;
$output = ”;
if ( $blog_array->have_posts() ):
$output .= ‘<div id=”blog-posts-products” class=”blog-posts-content posts-content main-ul”>’;
if($type == “slider”) {
if($count > $items_per_column)
$output .= ‘<div id=”‘.$items_per_column.’_blog_carousel” class=”slider blog-carousel”>’;
else
$output .= ‘<div id=”blog_grid” class=”blog-grid grid cols-‘.$items_per_column.'”>’;
} else {
$output .= ‘<div id=”blog_grid” class=”blog-grid grid cols-‘.$items_per_column.'”>’;
}

while ( $blog_array->have_posts() ) : $blog_array->the_post();

if($i % $items_per_column == 1 )
$class = ” first”;
elseif($i % $items_per_column == 0 )
$class = ” last”;
else
$class = “”;
$post_day = get_the_date(‘j’);
$post_month = get_the_date(‘M’);
$post_year = get_the_date(‘Y’);
$post_author = get_the_author();
$args = array(
‘status’ => ‘approved’,
‘number’ => ‘5’,
‘post_id’ => get_the_ID()
);
$comments = wp_count_comments(get_the_ID());
if ( has_post_thumbnail() && ! post_password_required() ) :
$post_thumbnail_id = get_post_thumbnail_id();
$image = wp_get_attachment_url( $post_thumbnail_id );
else:
$image = get_template_directory_uri().”/images/placeholders/placeholder.jpg”;
endif;
$src = mr_image_resize($image, 370, 200, true, ‘c’, false);
if( empty ( $src ) || $src == ‘image_not_specified’ ):
$src = get_template_directory_uri().”/images/megnor/placeholder.png”;
$src = mr_image_resize($src, 370, 200, true, ‘t’, false);
endif;
$output .= ‘<div class=”item container ‘.$class.'”>’;
$output .= ‘<div class=”container-inner”>’;
$output .= ‘<div class=”post-image”>’;
$output .= ‘<img src=”‘.$src.'” title=”‘.get_the_title().'” alt=”‘.get_the_title().'” />’;
$output .= ‘<div class=”block_hover”>’;
$output .= ‘<div class=”links”>’;
$output .= ‘<a href=”‘.$image.'” class=”icon mustang-gallery”><i class=”fa fa-search”></i></a>’;
$output .= ‘<a href=”‘.get_permalink().'” class=”icon”><i class=”fa fa-link”></i></a>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
$output .='<div class=”post-date”><div class=”day”>’.$post_day.'</div><div class=”month”>’.$post_month.'</div><div class=”year”>’.$post_year. ‘</div></div>’;
$output .= ‘<div class=”post-image-hover”></div>’;
$output .= ‘<a href=”‘.$image.'” data-lightbox=”example-set” class=”icon zoom”></a>’;
$output .= ‘</div>’;
$output .= ‘<div class=”post-author”>’;
$output .= ‘<div class=”post_author1″>’.$post_author.’&nbsp;&nbsp;</div>’;
/*if($comments->total_comments > 0):
$output .='<div class=”comments-link”><a href=”‘.get_permalink().'”>’.$comments->total_comments.’ comment </a></div>’;
else:
$output .='<div class=”comments-link”><a href=”‘.get_permalink().'”>Leave a comment </a></div>’;
endif;    */
$output .= ‘</div>’;
$output .= ‘<div class=”post-content-inner”>’;
$shorttitle = substr(get_the_title(”,”,FALSE),0,50);
$output .= ‘<div class=”post-title”><a href=”‘.get_permalink().'” title=”‘.get_the_title().'”>’.$shorttitle.'</a></div>’;
$output .= ‘<div class=”post-description”>’.templatemela_blog_post_excerpt(18).'</div>’;
/*if ( comments_open() && ! is_single() ) :
$args = array(
‘status’ => ‘approved’,
‘number’ => ‘5’,
‘post_id’ => get_the_ID()
);
$comments = wp_count_comments(get_the_ID());
if($comments->total_comments == 0)
$text = ‘Leave a comment’;
if($comments->total_comments == 1)
$text = $comments->total_comments.’ Comment’;
if($comments->total_comments > 1)
$text = $comments->total_comments.’ Comments’;
$output .= ‘<span class=”comments-link”> <i class=”fa fa-comment”></i>’.$text.'</span>’;
endif;*/

$output .= ‘</div></div></div>’;
$i++;
endwhile;
wp_reset_postdata();
$output .=    ‘</div></div>’;
else:
$output .= ‘<div class=”no-result”>No results found…</div>’;
endif;
return $output;
}
add_shortcode(‘blog_posts’, ‘shortcode_blog_posts_container’);

/***************** Latest News Posts ****************/

function shortcode_latest_news_container($atts, $content = null, $code) {
extract(shortcode_atts(array(
‘type’ => ‘slider’,
‘items_per_column’ => 1,
‘number_of_posts’ => 10,
‘category’ => ”,
‘align’ => ‘center’,
‘width’ => ‘100%’
), $atts));

$i = 1;
wp_reset_postdata();
$args = array(
‘posts_per_page’ => $number_of_posts,
‘post_status’ => ‘publish’,
‘category’ => $category,
‘orderby’ => ‘date’
);

$output = ”;
$news_array = new WP_Query( $args );

if ( $news_array->have_posts() ):
$output .= ‘<div id=”latest-news-products” class=”latest-news-content” style=”width:’.$width.'”>’;
if($type == “slider”) {
$output .= ‘<div id=”‘.$items_per_column.’_latest_news_carousel” class=”latest-news-carousel”>’;
} else {
$output .= ‘<div id=”latest_news_grid” class=”latest-news-grid latest-news-cols-‘.$items_per_column.'”>’;
}

while ( $news_array->have_posts() ) : $news_array->the_post();

if($i % $items_per_column == 1 )
$class = ” first”;
elseif($i % $items_per_column == 0 )
$class = ” last”;
else
$class = “”;
if ( has_post_thumbnail() && ! post_password_required() ) :
$post_thumbnail_id = get_post_thumbnail_id();
$image = wp_get_attachment_url( $post_thumbnail_id );
else:
$image = get_template_directory_uri().”/images/placeholders/placeholder.jpg”;
endif;
$src = mr_image_resize($image, 150, 150, true, ‘t’, false);
if( empty ( $src ) || $src == ‘image_not_specified’ ):
$src = get_template_directory_uri().”/images/megnor/placeholder.png”;
$src = mr_image_resize($src, 150, 150, true, ‘t’, false);
endif;
$output .= ‘<div class=”item single-post-container’.$class.’ ‘.$align.'”>’;
$output .= ‘<div class=”single-post”>’;
$output .= ‘<div class=”post-image”>’;
$output .= ‘<img src=”‘.$src.'” title=”‘.get_the_title().'” alt=”‘.get_the_title().'” />’;
$output .= ‘<div class=”post-image-hover”></div>’;
$output .= ‘<a href=”‘.$image.'” data-lightbox=”example-set” class=”icon zoom”></a>’;

$output .= ‘</div>’;
$shorttitle = substr(get_the_title(”,”,FALSE),0,50);
$output .= ‘<div class=”post-title”><a href=”‘.get_permalink().'” title=”‘.get_the_title().'”>’.$shorttitle.'</a></div>’;
$output .= ‘<div class=”post-description”>’.templatemela_blog_post_excerpt(25).'</div>’;
$output .= ‘<div class=”post-date”>’.date(“j M, Y”, strtotime(get_the_date())).'</div>’;
$output .= ‘</div></div>’;
$i++;
endwhile;
wp_reset_postdata();
$output .=    ‘</div></div>’;
else:
$output .= ‘<div class=”no-result”>No results found…</div>’;
endif;
return $output;
}
add_shortcode(‘latest_news’, ‘shortcode_latest_news_container’);

/***************** Google Map ****************/

function tm_mapshortcode( $atts, $content = null )
{
extract( shortcode_atts( array(
‘latlong’ => ‘-33.86938,151.204834’,
‘icon’ => get_template_directory_uri().’/images/megnor/map-pin.png’,
‘height’ => ‘400’,
‘id’ => ‘0’
), $atts ) );

$text = preg_replace(‘#^<\/p>|<p>$#’, ”, do_shortcode($content));

return tm_googleMap($latlong, $text, $icon, $height, 1, ”);

}
add_shortcode(‘tm_map’, ‘tm_mapshortcode’);

/***************** Addess ****************/
function shortcode_address($atts, $content = null)
{
extract(shortcode_atts(array(
‘title’ => ”,
‘description’ => ”,
‘address_label’ => ‘Address:’,
‘phone_label’ => ‘Phone numbers:’,
‘phone’ => ”,
’email_label’ => ‘Email:’,
’email’ => ”,
’email_link’ => ”,
‘other_label’ => ‘We are open:’,
‘other’ => ”,

), $atts));
$output = ”;
$output .= ‘<div class=”address-container hb-animate-element right-to-left”>’;
if(!empty($title))
$output .= ‘<h1 class=”address-title simple-title”><span>’.$title.'</span></h1>’;
if(!empty($description))
$output .= ‘<div class=”address-description description”>’.$description.'</div>’;

/*$output .= ‘<div class=”address-label”>’.$address_label.'</div>’;*/
$output .= ‘<div class=”address-text”><i class=”fa fa-map-marker”></i>’.do_shortcode($content).'</div>’;

if(!empty($phone)):
/*$output .= ‘<div class=”address-label”>’.$phone_label.'</div>’;*/
$output .= ‘<div class=”address-text”><i class=”fa fa-phone”></i>’.$phone.'</div>’;
endif;

if(!empty($email)):
/*$output .= ‘<div class=”address-label”>’.$email_label.'</div>’;*/
if(!empty($email_link)):
$output .= ‘<div class=”address-text”><i class=”fa fa-envelope “></i><a herf=”‘.$email_link.'”>’.$email.'</a></div>’;
else:
$output .= ‘<div class=”address-text><i class=”fa fa-envelope “></i>’.$email.’></div>’;
endif;
endif;
if(!empty($other)):
/*$output .= ‘<div class=”address-label”>’.$other_label.'</div>’;*/
$output .= ‘<div class=”address-text”><i class=”fa fa-info”></i>’.$other.'</div>’;
endif;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘tm_address’, ‘shortcode_address’);

/***************** Static links ****************/

function shortcode_link($atts, $content = null)
{
extract(shortcode_atts(array(
‘link_url’ =>  ”,
), $atts));
$output = ”;
if(!empty($link_url))
$output .= ‘<li><a href=”‘.$link_url.'”>’.do_shortcode($content).'</a></li>’;
else
$output .= ‘<li>’.do_shortcode($content).'</li>’;
return $output;
}
add_shortcode(‘link’, ‘shortcode_link’);

function shortcode_tm_links($atts, $content = null)
{
extract(shortcode_atts(array(
), $atts));
$output = ”;
$output .= ‘<ul class=”links”>’;
$output .= do_shortcode($content);
$output .=    ‘</ul>’;
return $output;
}
add_shortcode(‘tm_links’, ‘shortcode_tm_links’);

/***************** H family ****************/

function shortcode_h1($atts, $content = null) {

extract(shortcode_atts(array(
), $atts));

$output = ”;
$output .= ‘<h1>’;
$output .=    do_shortcode($content);
$output .=    ‘</h1>’;
return $output;
}
add_shortcode(‘tm_h1’, ‘shortcode_h1’);

function shortcode_h2($atts, $content = null) {

extract(shortcode_atts(array(
), $atts));

$output = ”;
$output .= ‘<h2>’;
$output .=    do_shortcode($content);
$output .=    ‘</h2>’;
return $output;
}
add_shortcode(‘tm_h2’, ‘shortcode_h2’);

function shortcode_h3($atts, $content = null) {

extract(shortcode_atts(array(
), $atts));

$output = ”;
$output .= ‘<h3>’;
$output .=    do_shortcode($content);
$output .=    ‘</h3>’;
return $output;
}
add_shortcode(‘tm_h3’, ‘shortcode_h3’);

function shortcode_h4($atts, $content = null) {

extract(shortcode_atts(array(
), $atts));

$output = ”;
$output .= ‘<h4>’;
$output .=    do_shortcode($content);
$output .=    ‘</h4>’;
return $output;
}
add_shortcode(‘tm_h4’, ‘shortcode_h4’);

function shortcode_h5($atts, $content = null) {

extract(shortcode_atts(array(
), $atts));

$output = ”;
$output .= ‘<h5>’;
$output .=    do_shortcode($content);
$output .=    ‘</h5>’;
return $output;
}
add_shortcode(‘tm_h5’, ‘shortcode_h5’);

function shortcode_h6($atts, $content = null) {

extract(shortcode_atts(array(
), $atts));

$output = ”;
$output .= ‘<h6>’;
$output .=    do_shortcode($content);
$output .=    ‘</h6>’;
return $output;
}
add_shortcode(‘tm_h6’, ‘shortcode_h6’);

/*============== All Boxes ==================*/

function shortcode_successbox($atts, $content=null, $code=””) {
$return = ‘<div class=”success-message message”>’;
$return .= $content;
$return .= ‘</div>’;
return $return;
}
add_shortcode(‘tm_success’ , ‘shortcode_successbox’ );

function shortcode_errorbox($atts, $content=null, $code=””) {
$return = ‘<div class=”error-message message”>’;
$return .= $content;
$return .= ‘</div>’;
return $return;
}
add_shortcode(‘tm_error’ , ‘shortcode_errorbox’ );

function shortcode_messagebox($atts, $content=null, $code=””) {
$return = ‘<div class=”message-message message”>’;
$return .= $content;
$return .= ‘</div>’;
return $return;
}
add_shortcode(‘tm_message’ , ‘shortcode_messagebox’ );

function shortcode_warningbox($atts, $content=null, $code=””) {
$return = ‘<div class=”warning-message message”>’;
$return .= $content;
$return .= ‘</div>’;
return $return;
}
add_shortcode(‘tm_warning’ , ‘shortcode_warningbox’ );

/***************** Products ****************/

function shortcode_woo_products_container($atts, $content = null, $code) {
global $logotype;
extract(shortcode_atts(array(
‘type’ => ‘grid’,
‘items_per_column’ => 3,
‘product’ => ‘shop’
), $atts));

$logotype = $type;

$output = ”;
$output .= ‘<div id=”woo-products” class=”woo-content products_block ‘.$product.'”>’;

if($type == “slider”) {
$output .= ‘<div id=”‘.$items_per_column.’_woo_carousel” class=”woo-carousel”>’;
} else {
$output .= ‘<div id=”woo_grid” class=”woo-grid cols-‘.$items_per_column.'”>’;
}
$output .=    do_shortcode($content).'</div></div>’;
return $output;
}
add_shortcode(‘woo_products’, ‘shortcode_woo_products_container’);

/******************* WooCommerce Small Prodcuts ******/
function shortcode_woo_small_products_container($atts, $content = null, $code) {
global $logotype;
extract(shortcode_atts(array(
‘type’ => ‘grid’,
‘items_per_column’ => 2,
), $atts));

$logotype = $type;

$output = ”;
$output .= ‘<div id=”woo-small-products” class=”woo-content products_block”>’;

if($type == “slider”) {
} else {
$output .= ‘<div id=”woo_grid” class=”woo-grid cols-‘.$items_per_column.'”>’;
}
$output .=    do_shortcode($content).'</div></div>’;
return $output;
}
add_shortcode(‘woo_small_products’, ‘shortcode_woo_small_products_container’);

function shortcode_cms_text($atts, $content = null, $code) {
extract(shortcode_atts(array(
‘icon’ => ‘fa-arrows-alt’,
‘link_text’ => ”,
‘link_url’ => ”,
‘border’ => ‘yes’,
‘color’ =>”,
), $atts));

$output = ”;
$variables = ”;

if(!empty($border)):
$variables .= ‘border-right:1px solid #’.$color.”;
endif;
$output .= ‘<div class=”cmstext” style=”‘.$variables.'”>’;
$output .= ‘<div class=”icon”><i class=”cms-icon fa ‘.$icon.'” ></i> </div>’;
$output .= ‘<a href=”‘.$link_url.'”>’.$link_text.'</a>’;
$output .= ‘</div>’;

return $output;
}
add_shortcode(‘tm_cms_text’, ‘shortcode_cms_text’);

/*=============CMS Banner ============ */
function shortcode_cmsbanner($atts, $content = null)
{
extract(shortcode_atts(array(
‘background_image’ => ”,
‘background_repeat’ => ‘no-repeat’,
‘text1’ => ”,
‘text2’ => ”,
“border_color”=> ‘ffffff’,
“padding” => ’10px’,
“border” => ”,
‘margin’ =>    ”,
), $atts));

$variables  = ”;
$output = ”;

if(!empty($background_image))
$variables .= ‘background-image: url(‘.$background_image.’);’;
$variables .= ‘background-repeat:’.$background_repeat.’;’;
if($border == ‘yes’)
{
$variables .= ‘border-left:1px solid #’.$border_color.’;’;
$variables .= ‘border-right:1px solid #’.$border_color.’;’;
}
$variables .= ‘padding:’.$padding.’;’;
$variables .= ‘margin:’.$margin.’;’;

$output .= ‘<div class=”cms-container center” style=”‘.$variables.'”>’;

$output .= ‘<div class=”cms-content”>’;
$output .= ‘<div class=”cms-content-inner”>’;
$output .= ‘<div class=”cms-title”><a href=”‘.$link_url.'” class=”text1″>’.$text1.'</a><a class=”text2″>’.$text2.'</a></div>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘cmsbanner’, ‘shortcode_cmsbanner’);

/*=============Sub Banner ============ */
function shortcode_subbanner($atts, $content = null)
{
extract(shortcode_atts(array(
‘image’    => ”,
‘padding’ => ”,
‘margin’ => ”,
‘height’ => ”,
‘width’ => ”,

), $atts));

$variables  = ”;
$output = ”;

if(!empty($image)) :
$variables .= ‘padding:’.$padding.’;’;
$variables .= ‘margin:’.$margin.’;’;
endif;

$output .= ‘<div class=”sub-container center” style=”‘.$variables.'”>’;
$output .= ‘<div class=”inner-image”><a href=”‘.$link_url.'” target=”_Blank”><img src=’.$image.’ height=”‘.$height.'” width=”‘.$width.'”></a></div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘subbanner’, ‘shortcode_subbanner’);

function shortcode_cms_banner($atts, $content = null)
{
extract(shortcode_atts(array(
‘background_img’ => ”,
‘background_color’ => ”,
‘background_repeat’ => ‘no-repeat’,
‘image’ => ”,
‘maintitle’ => ”,
‘subtitle’ => ”,
), $atts));

if($backgroung_img != NULL) {
$get_imagepath = $backgroung_img;
} else {
$get_imagepath = get_template_directory_uri() . ‘/images/megnor/no_image.jpg’;
}

$output = ”;
$variables = ”;
if(!empty($background_img)):
$variables .= ‘background-image: url(‘.$background_img.’);’;
$variables .= ‘background-color:#’.$background_color.’;’;
$variables .= ‘background-repeat:’.$background_repeat.’;’;
endif;
$output .='<div class =”tm_cms_banner column1″ style=”‘.$variables.’);”>’;
$output .= ‘<div class =”cms-image”><img src=”‘.$image.'”></div>’;
$output .='<div class =”tm_cms_banner_inner”>’;
$output .='<div class = “maintitle”>’.$maintitle.'</div>’;
$output .='<div class = “subtitle”>’.$subtitle.'</div>’;
$output .='</div> </div>’;

return $output;
}
add_shortcode(‘tm_cms_banner’, ‘shortcode_cms_banner’);

/*=============Latest Product Information============ */

function shortcode_information($atts, $content = null) {
extract(shortcode_atts(array(
‘title’ => ”,
‘description’ => ”,
), $atts));

$output = ”;
$output    .= ‘<div class=”information”>’;
$output .= ‘<div class=”info-title”>’ .$title. ‘</div>’;
$output    .= ‘<div class=”info-description”>’ .$description. ‘</div>’;
$output    .= ‘</div>’;
return $output;
}
add_shortcode(“information”, “shortcode_information”);

function shortcode_product_tabs($atts, $content = null)
{
extract(shortcode_atts(array(
‘tab1_text’ => ”,
‘tab2_text’ => ”,
‘tab3_text’ => ”,
), $atts));

$output = ”;

$output .= ‘<div id=”horizontalTab”>’;
$output .= ‘<ul class=”resp-tabs-list”>’;
$output .= ‘<li class=”hb-animate-element top-to-bottom”>’.$tab1_text. ‘</li>’;
$output .= ‘<li class=”hb-animate-element top-to-bottom”>’.$tab2_text. ‘</li>’;
$output .= ‘<li class=”hb-animate-element top-to-bottom”>’.$tab3_text. ‘</li>’;
$output .= ‘</ul>’;
$output .= ‘<div class=”resp-tabs-container”>’;
$output .= do_shortcode($content);
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘tm_product_tabs’, ‘shortcode_product_tabs’);

/***** Product Category Tabs List******/
function shortcode_woo_category_slider($atts, $content = null, $code) {
extract(shortcode_atts(array(
‘category_ids’ => ‘95,105,102,103’,
‘items_per_column’ => ‘4’,
), $atts));

$category_ids_array = explode(“,”,$category_ids);
$category_ids_array[] = $category_ids_array;

$output = ”;
$output .= ‘<div id=”categorytab”>’;
$category_ids = ”;
$term_category_id = ”;
$term_category_name = ”;
$term_categroy_slug = ”;
$term_thumbnai_id = ”;
$term_image = ”;
$output .= ‘<ul class=”resp-tabs-list”>’;
foreach($category_ids_array as $key){
$category_ids = get_term( $key, ‘product_cat’ );
if($category_ids){
$term_category_id = $category_ids->term_id;
$term_category_name = $category_ids->name;
$term_category_slug = $category_ids->slug;
$term_thumbnail_id =  get_woocommerce_term_meta( $term_category_id , ‘thumbnail_id’, true );
$term_image = wp_get_attachment_url( $term_thumbnail_id );  // get the image URL
$output .= ‘<li>’.$term_category_name.'</li>’;
}
}
$output .= ‘</ul>’;
$output .= ‘<div class=”resp-tabs-container”>’;
foreach($category_ids_array as $key){
$term_array = get_term( $key, ‘product_cat’ );
$term_category_id = $term_array->term_id;
$term_category_slug = $term_array->slug;
$output .= do_shortcode(‘

‘);
}
$output .= ‘</div>’;
$output .= ‘</div>’;
return $output;
}
add_shortcode(‘woo_categories’, ‘shortcode_woo_category_slider’);
//deactivate WordPress function
remove_shortcode(‘gallery’, ‘gallery_shortcode’);

//activate own function
add_shortcode(‘gallery’, ‘msdva_gallery_shortcode’);
function msdva_gallery_shortcode($attr) {
$post = get_post();

static $instance = 0;
$instance++;

if ( ! empty( $attr[‘ids’] ) ) {
// ‘ids’ is explicitly ordered, unless you specify otherwise.
if ( empty( $attr[‘orderby’] ) )
$attr[‘orderby’] = ‘post__in’;
$attr[‘include’] = $attr[‘ids’];
}

// Allow plugins/themes to override the default gallery template.
$output = apply_filters(‘post_gallery’, ”, $attr);
if ( $output != ” )
return $output;

// We’re trusting author input, so let’s at least make sure it looks like a valid orderby statement
if ( isset( $attr[‘orderby’] ) ) {
$attr[‘orderby’] = sanitize_sql_orderby( $attr[‘orderby’] );
if ( !$attr[‘orderby’] )
unset( $attr[‘orderby’] );
}

extract(shortcode_atts(array(
‘order’ => ‘ASC’,
‘orderby’ => ‘menu_order ID’,
‘id’ => $post ? $post->ID : 0,
‘itemtag’ => ‘dl’,
‘icontag’ => ‘dt’,
‘captiontag’ => ‘dd’,
‘divtag’ => ‘div’,
‘columns’ => 3,
‘size’ => ‘full’,
‘include’ => ”,
‘exclude’ => ”,
‘link’ => ‘file’ // CHANGE #1
), $attr, ‘gallery’));

$id = intval($id);
if ( ‘RAND’ == $order )
$orderby = ‘none’;

if ( !empty($include) ) {
$_attachments = get_posts( array(‘include’ => $include, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );

$attachments = array();
foreach ( $_attachments as $key => $val ) {
$attachments[$val->ID] = $_attachments[$key];
}
} elseif ( !empty($exclude) ) {
$attachments = get_children( array(‘post_parent’ => $id, ‘exclude’ => $exclude, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );
} else {
$attachments = get_children( array(‘post_parent’ => $id, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) );
}

if ( empty($attachments) )
return ”;

if ( is_feed() ) {
$output = “\n”;
foreach ( $attachments as $att_id => $attachment )
$output .= templatemela_wp_get_attachment_link($att_id, $size, true) . “\n”;
return $output;
}

$itemtag = tag_escape($itemtag);
$captiontag = tag_escape($captiontag);
$icontag = tag_escape($icontag);
$valid_tags = wp_kses_allowed_html( ‘post’ );
if ( ! isset( $valid_tags[ $itemtag ] ) )
$itemtag = ‘dl’;
if ( ! isset( $valid_tags[ $captiontag ] ) )
$captiontag = ‘dd’;
if ( ! isset( $valid_tags[ $icontag ] ) )
$icontag = ‘dt’;

$columns = intval($columns);
$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
$float = is_rtl() ? ‘right’ : ‘left’;

$selector = “gallery-{$instance}”;

$gallery_style = $gallery_div = ”;
if ( apply_filters( ‘use_default_gallery_style’, true ) )
$gallery_style = ”
<style type=’text/css’>
#{$selector} {
margin: auto;
}
#{$selector} .gallery-item {
float: {$float};
margin-top: 10px;
text-align: center;
width: {$itemwidth}%;
}
#{$selector} img {
border: 2px solid #cfcfcf;
}
#{$selector} .gallery-caption {
margin-left: 0;
}
/* see gallery_shortcode() in wp-includes/media.php */
</style>”;
$size_class = sanitize_html_class( $size );
$gallery_div = “<div id=’$selector’ class=’gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}’>”;
$output = apply_filters( ‘gallery_style’, $gallery_style . “\n\t\t” . $gallery_div );

$i = 0;

foreach ( $attachments as $id => $attachment ) {
$image_url = $attachment->guid;
$image_output = templatemela_wp_get_attachment_link( $id, $size, true, false );
$image_meta = wp_get_attachment_metadata( $id );

$orientation = ”;
if ( isset( $image_meta[‘height’], $image_meta[‘width’] ) )
$orientation = ( $image_meta[‘height’] > $image_meta[‘width’] ) ? ‘portrait’ : ‘landscape’;
$output .= “<{$itemtag} class=’gallery-item’>”;
$output .= ”
<{$icontag} class=’gallery-icon {$orientation}’>
$image_output
</{$icontag}>”;
$output .= ”
<{$captiontag} class=’wp-caption-text gallery-caption’>
<{$divtag} class=’gallery-caption-inner’>”;

$output .= ” <{$divtag} class=’wp-caption-text gallery-title’>
” . wptexturize($attachment->post_title) . ”
</{$divtag}>”;

if ( $captiontag && trim($attachment->post_excerpt) ) {
$output .= “<{$divtag} class=’wp-caption-text gallery-excerpt’>”;
if($columns == 1):
$excerpt_length = 100;
elseif($columns == 2):
$excerpt_length = 300;
elseif($columns == 3):
$excerpt_length = 200;
elseif($columns == 4):
$excerpt_length = 50;
elseif($columns == 5):
$excerpt_length = 10;
endif;
$output .= substr($attachment->post_excerpt,0,$excerpt_length);
$output .= “</{$divtag}>”;

$output .= “<{$divtag} class=’wp-caption-text gallery-zoom’>
<a href=” . $image_url . ” title=’Click to view Full Image’ class=’icon mustang-gallery’><i class=’fa fa-search’></i></a>
</{$divtag}>”;

$output .= “<{$divtag} class=’wp-caption-text gallery-redirect’>
<a href=” . get_attachment_link( $attachment->ID ) . ” title=’Click to view Read More’ class=’icon readmore’><i class=’fa fa-share’></i></a>
</{$divtag}>”;
}else{

$output .= “<{$divtag} class=’wp-caption-text gallery-zoom no-text’>
<a href=” . $image_url . ” title=’Click to view Full Image’ class=’icon mustang-gallery’><i class=’fa fa-search’></i></a>
</{$divtag}>”;
$output .= “<{$divtag} class=’wp-caption-text gallery-redirect’>
<a href=” . get_attachment_link( $attachment->ID ) . ” title=’Click to view Read More’ class=’icon readmore’><i class=’fa fa-share’></i></a>
</{$divtag}>”;
}
$output .= “</{$divtag}>”;
$output .= “</{$captiontag}>”;
$output .= “</{$itemtag}>”;
}

$output .= ”
</div>\n”;

return $output;
}

function templatemela_wp_get_attachment_link( $id = 0, $size = ‘thumbnail’, $permalink = true, $icon = false, $text = false ) {
$id = intval( $id );
$_post = get_post( $id );
if ( empty( $_post ) || ( ‘attachment’ != $_post->post_type ) || ! $url = wp_get_attachment_url( $_post->ID ) )
return __( ‘Missing Attachment’, ‘templatemela’ );

if ( $permalink )
// $url = get_attachment_link( $_post->ID ); // we want the “large” version!!
// FIX!! ask for large URL
$image_attributes = wp_get_attachment_image_src( $_post->ID, ‘large’ );
$url = $image_attributes[0];
// $url = wp_get_attachment_image( $_post->ID, ‘large’ );

$post_title = esc_attr( $_post->post_title );

if ( $text )
$link_text = $text;
elseif ( $size && ‘none’ != $size )
$link_text = wp_get_attachment_image( $id, $size, $icon );
else
$link_text = ”;

if ( trim( $link_text ) == ” )
$link_text = $_post->post_title;
return apply_filters( ‘wp_get_attachment_link’, “<span rel=’gallery-nr’>$link_text</span>”, $id, $size, $permalink, $icon, $text );
}
?>]Accordion


[ tm_accordion style=”1″ ]
[ accordion title=”Nam tempor diam elit”]Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. [ /accordion]
[ accordion title=”Nam tempor diam elit”]Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. [ /accordion ]
[ accordion title=”Nam tempor diam elit” ]Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. [ /accordion ]
[ /tm_accordion ]

Style One and Two Accordion



Style One Accordion



Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.



Style Two Accordion



Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.


Style Three and Four Accordion



Style Three Accordion



Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.




Style Four Accordion



Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.



Toggle Code

Toggle


[ tm_toggle style=”1″ ]
[ toggle title=”Nam tempor diam elit”]Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. [ /toggle]
[ toggle title=”Nam tempor diam elit”]Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. [ /toggle ]
[ toggle title=”Nam tempor diam elit” ]Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. [ /toggle ]
[ /tm_toggle ]

Style One and Two Toggle



Style One Toggle



Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.




Style Two Toggle



Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.



Style Three and Four Toggle



Style Three Toggle



Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.




Style Four Toggle



Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.

Nam tempor diam elit
Nunc molestie dolor nec magna fermen atum in pharetra orci mollis. Nam tempor diam elit. Praesent magna metus, conse viverra nec, convallis et lacus.



X