<?
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":700,"date":"2016-01-12T23:59:40","date_gmt":"2016-01-12T23:59:40","guid":{"rendered":"http:\/\/loads.application.pk\/?post_type=product&#038;p=700"},"modified":"2016-04-29T05:16:40","modified_gmt":"2016-04-29T05:16:40","slug":"ins-heat-petrol","status":"publish","type":"product","link":"http:\/\/loads-group.pk\/urdu\/product\/ins-heat-petrol\/","title":{"rendered":"Ins. Heat (petrol)"},"content":{"rendered":"","protected":false},"excerpt":{"rendered":"<p><strong>INS. HEAT (PETROL)<\/strong><br \/>\n<strong>Size:<\/strong> SA1D80-CZ 0.7mm<br \/>\n<strong>OEM:<\/strong> PAK SUZUKI<br \/>\n<strong>Loads Code:<\/strong> 3601-105<br \/>\n<strong>VEHICLE:<\/strong> SWIFT CAR<\/p>\n","protected":false},"featured_media":535,"comment_status":"open","ping_status":"closed","template":"","meta":[],"product_brand":[],"product_cat":[10],"product_tag":[],"_links":{"self":[{"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/product\/700"}],"collection":[{"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/product"}],"about":[{"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/types\/product"}],"replies":[{"embeddable":true,"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/comments?post=700"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/media\/535"}],"wp:attachment":[{"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/media?parent=700"}],"wp:term":[{"taxonomy":"product_brand","embeddable":true,"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/product_brand?post=700"},{"taxonomy":"product_cat","embeddable":true,"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/product_cat?post=700"},{"taxonomy":"product_tag","embeddable":true,"href":"http:\/\/loads-group.pk\/urdu\/wp-json\/wp\/v2\/product_tag?post=700"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}