<?
function add_map( $atts, $content = null ) {
    return '<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
        <script type="text/javascript" src="'.get_bloginfo('template_url').'/js/jquery.gmap.js"></script>
        <script type="text/javascript">
            $(\'#google-map\').gMap({
                address: \''.$atts["id"].'\',
                maptype: "ROADMAP",
                zoom: 14,
                markers: [
                    {
                        address: "'.$atts["id"].'",
                        html: `'.$content.'`,
                        icon: {
                        image: "'.get_bloginfo('template_url').'/images/icons/map-icon-red.png",
                            iconsize: [31, 50],
                            iconanchor: [31,50]
                        }
                    }
                ],
                doubleclickzoom: true,
                controls: {
        panControl: true,
                    zoomControl: true,
                    mapTypeControl: true,
                    scaleControl: true,
                    streetViewControl: false,
                    overviewMapControl: true
                }

            });

</script>
';
}

function add_clients( $atts, $content = null ) {
    preg_match_all('#src="(.*?)"#i',$content,$matches);
    $string = '<div id="oc-team-list" class="owl-carousel team-carousel">';
    foreach($matches[1] as $match)
   $string .= '<div class="oc-item">
          <img src="'.$match.'" />
            </div>';
    $string .= '</div>';
    return $string;
}

function register_my_menu() {
    register_nav_menu('header-menu',__( 'Header Menu' ));
    register_nav_menu('footer-menu',__( 'Footer Menu' ));

}

add_action( 'init', 'register_my_menu' );
add_shortcode( 'map', 'add_map' );
add_shortcode( 'clients', 'add_clients' );

remove_action( 'woocommerce_before_main_content', 'woocommerce_output_content_wrapper', 10);
remove_action( 'woocommerce_after_main_content', 'woocommerce_output_content_wrapper_end', 10);
add_action('woocommerce_before_main_content', 'my_theme_wrapper_start', 10);
add_action('woocommerce_after_main_content', 'my_theme_wrapper_end', 10);

function my_theme_wrapper_start() {
    echo '<section id="main">';
}

function my_theme_wrapper_end() {
    echo '</section>';
}
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
    add_theme_support( 'woocommerce' );
}

function shop_left_init() {

    register_sidebar( array(
        'name'          => 'Categories',
        'id'            => 'home_left_1',
        'before_widget' => '<div class="widget-category-menu">',
        'after_widget'  => '</div>',
        'before_title'  => '<h3 class="rounded"><i class="icon-settings2"></i> ',
        'after_title'   => '</h3>',
    ) );

}
add_action( 'widgets_init', 'shop_left_init' );
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 36;' ), 36 );

function woo_related_products_limit() {
    global $product;

    $args['posts_per_page'] = 3;
    return $args;
}
add_filter( 'woocommerce_output_related_products_args', 'jk_related_products_args' );
function jk_related_products_args( $args ) {
    $args['posts_per_page'] = 3; // 4 related products
    $args['columns'] = 1; // arranged in 2 columns
    return $args;
}
add_filter( 'woocommerce_product_tabs', 'wcs_woo_remove_reviews_tab', 98 );
function wcs_woo_remove_reviews_tab($tabs) {
    unset($tabs['reviews']);
    return $tabs;
}

add_action( 'woocommerce_after_shop_loop_item_title', 'my_add_short_description', 9 );
function my_add_short_description() {
	  echo '<span class="title-description">' . the_excerpt() . '</span><br />';
}

{"id":9,"count":16,"description":"Mufflers &amp; Exhaust Systems are manufactured according to customers\u2019 designs, specifications and standards. All prime raw materials, like stainless steel, galvanized iron, aluminized steel pipes and sheets, are imported from Europe and Japan. Catalytic converters are used in euro models. Flexible couplings are also used to dampen engine vibration. Noise levels are minimized by using glass wool and perforated pipes in chambers. Loads\u2019 Mufflers prove to be economical in the long run because of their durability and increased fuel efficiency of engine.\r\n","link":"http:\/\/loads-group.pk\/urdu\/products\/mufflers\/","name":"Mufflers &amp; Exhaust Systems","slug":"mufflers","taxonomy":"product_cat","parent":0,"meta":[],"menu_order":3,"_links":{"self":[{"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/product_cat\/9"}],"collection":[{"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/product_cat"}],"about":[{"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/taxonomies\/product_cat"}],"wp:post_type":[{"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/product?product_cat=9"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}