How remove “Description” title from product details page

Hello Friends!!

I am here going to share useful knowledge about woocommerce hooks. On product page if you want to remove “Description” title under “Description Tab” without any changes in woocommerce core files then follow given steps. You will just need to add given below code into your theme function.php file.


add_filter( 'woocommerce_product_description_heading', 'remove_product_description_heading' );
function remove_product_description_heading() {
return '';
}

Enjoy Code!

Tagged with: , , ,
Posted in woocommerce, Wordpress

How create custom post type URL with category slug

Hello Friends!!

I am here going to share my knowledge  about one  more important hooks of the wordpress. If you have created a custom post type and want to add their custom taxonomy category slug as prefix in post URL without any changes in wordpress core files then follow given steps. You will need to add given below code into your theme function.php file.

  1. Register new custom post type if you have already not done it
    if(!function_exists('mrweb_acticle_post_type_func')){
     function mrweb_acticle_post_type_func()
     {
    
     $labels = array(
     'name' => __( 'Article', 'mrwebsolution' ),
     'singular_name' => __( 'Article', 'mrwebsolution' ),
     'add_new' => __( 'Add New', 'mrwebsolution' ),
     'add_new_item' => __( 'Add New Article', 'mrwebsolution' ),
     'edit_item' => __( 'Edit Article', 'mrwebsolution' ),
     'new_item' => __( 'New Article', 'mrwebsolution' ),
     'view_item' => __( 'View Article', 'mrwebsolution' ),
     'search_items' => __( 'Search Article', 'mrwebsolution' ),
     'not_found' => __( 'No Article Found', 'mrwebsolution' ),
     'not_found_in_trash' => __( 'No article Found In Trash', 'mrwebsolution' ),
     'parent_item_colon' => '',
     'menu_name' => __( 'Article', 'mrwebsolution' )
     );
     $args = array(
     'labels' => $labels,
     'menu_icon' => 'dashicons-admin-post',
     'public' => true,
     'publicly_queryable' => true,
     'show_ui' => true,
     'show_in_menu' => true,
     'query_var' => true,
     'rewrite' => array( 'slug' => 'articles/%mrweb_article_term%' ),
     'capability_type' => 'post',
     'hierarchical' => true,
     'menu_position' => null,
     'has_archive' => 'articles',
     'supports' => array( 'title', 'editor','thumbnail', 'page-attributes', 'comments', 'author')
     );
    
     register_post_type( 'mrweb_article', $args);
     }
     }
     add_action('init', 'mrweb_acticle_post_type_func');
  2.  Register new custom taxonomy type if you have already not done it
    // hook into the init action and call create_book_taxonomies when it fires
     add_action( 'init', 'create_mrweb_article_taxonomies', 0 );
    
     // create two taxonomies, genres and writers for the post type "book"
     if(!function_exists('create_mrweb_article_taxonomies'))
     {
     function create_mrweb_article_taxonomies() {
     $labels = array(
     'name' => __('Blog Categories', 'mrwebsolution'),
     'singular_name' => __('Category', 'mrwebsolution'),
     'search_items' => __('Search Categories', 'mrwebsolution'),
     'all_items' => __('All Categories', 'mrwebsolution'),
     'parent_item' => __('Parent', 'mrwebsolution'),
     'parent_item_colon' => __('Parent:', 'mrwebsolution'),
     'edit_item' => __('Edit Category', 'mrwebsolution'),
     'update_item' => __('Update Category', 'mrwebsolution'),
     'add_new_item' => __('Add New Category', 'mrwebsolution'),
     'new_item_name' => __('New Category', 'mrwebsolution'),
     'menu_name' => __('Categories', 'mrwebsolution'),
     );
     $args = array(
     'hierarchical' => true,
     'labels' => $labels,
     'show_ui' => true,
     'show_admin_column' => true,
     'query_var' => true,
     'rewrite' => array( 'slug' => 'articles','with_front' => false ),
     );
     register_taxonomy( 'mrweb_article_term', array( 'mrweb_article' ), $args ); 
     }
     }
  3. Add a new hooks filter post_type_link
    /** filter URL link for post type url **/
     add_filter('post_type_link', 'acrticles_permalink_structure', 10, 4);
     function acrticles_permalink_structure($post_link, $post, $leavename, $sample)
     {
     if ( false !== strpos( $post_link, '%mrweb_article_term%' ) ) {
     $event_type_term = get_the_terms( $post->ID, 'mrweb_article_term' );
     if($event_type_term)
     $post_link = str_replace( '%mrweb_article_term%', array_pop( $event_type_term )->slug, $post_link );
     }
     return $post_link;
     }
  4. That’s it 🙂

Share with your friend 🙂

Tagged with: ,
Posted in Wordpress

Happy New Year 2017 !!

💐💐💐💐💐💐💐💐💐

🌹 Happy New Year-2017 🌹

ये नववर्ष आपके जीवन में खुशियां ही खुशियां 😊😊लेकर आये। ईश्वर की कृपा आप पर सदैव बनी रहे आप उन्नति के शिखर पर रहे इन्ही शुभ कामनाओं 👏🏼👏🏼के साथ आप और आपके पुरे परिवार 👨‍👩‍👧‍👦को मेरी तरफ से नववर्ष
💥💥2017 💥💥
की शुभ कामनाए।
🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🙏🍃💐💐💐💐💐🌿

Posted in Wordpress

Released a new brand “WP Categories Widget” wordpress plugin

Hello Friends!!

I hope your are doing well.

I want let you know all that today we have released A new brand “WP Categories Posts” wordpress plugin. This plugin will be very helpful to manage list of category for your custom taxonomy types OR Category.  Using our this plugin you will able to define list of categories for any custom taxonomy type.

PLUGIN FEATURES :

  • An option for show categories post count
  • An option for define hide widget title
  • An option for choose to your custom taxonomy
  • An option for exclude categories

Please have a look on below link for download “WP Posts Widget” plugin.

Click Here to download plugin
 

Please don’t forget to leave your feedback and suggestions for make it much more user friendly.

 

Tagged with: , , ,
Posted in Wordpress

Released a new brand “WP Posts Widget” wordpress plugin

Hello Friends!!

I hope your are doing well.

I want let you know all that today we have released new wordpress widget plugin. This plugin will be very helpful to manage recent posts for your custom post types.  Using our this plugin you will able to define recent posts of any post type.

PLUGIN FEATURES :

  • An option for show comment count
  • An option for define hide widget title
  • An option for choose to your custom post type
  • An option for exclude specific posts.
  • An option for define post filter order.
  • An option for define to number of posts

Please have a look on below link for download “WP Posts Widget” plugin.

https://wordpress.org/plugins/wp-posts-widget/

 

Please don’t forget to leave your feedback and suggestions for make it much more user friendly.

 

Tagged with: ,
Posted in Wordpress

How remove NULL value from array in Angular JS?

Hello Friends!

I hope you are doing well.

This my first post on angular JS. I was getting a issue during ng-repeat loop in IE8 browser, loop was working fine in all browsers but in IE8, it was repeating one more extra time. that’s mean if actual loop is running 4 time then same loop is repeating 5 times in IE8, means one time extra.

During review issue i have found that in array there were a null value was adding by default in IE8 browsers and that’s why loop was running one extra time.

If you are also getting this type of issue then you can try given below steps for resolved to issue.

  1. Define a new function in your controller file
    app.filter('emptyFilter', function() {
      return function(array) {
        var filteredArray = [];
          angular.forEach(array, function(item) {
            if (item) filteredArray.push(item);
          });
        return filteredArray;  
      };
    });
  2. add empty filter function with ng-repeat
    <ul>
    <li ng-repeat="x in students| emptyFilter">x.name</li>
    </ul>

Note: here students is a array variable.

I hope you all will enjoy my this post 🙂

Tagged with: , , ,
Posted in Angular JS

Geting UPS Shipping Rate By PHP

<!-- Create Function -->
<?php
function ups($dest_zip,$service,$weight,$length,$width,$height) {

	// ========== UPDATE FOLLWINGS WITH YOUR CREDENTIALS ===========

	$AccessLicenseNumber = '###########'; // License number
	$UserId = '########'; // Username
	$Password = '########'; // Password
	$PostalCode = '######'; // Zipcode you are shipping FROM
	$ShipperNumber = '#####'; //  UPS shipper number

	
    	$data ="<?xml version=\"1.0\"?>
    	<AccessRequest xml:lang=\"en-US\">
    		<AccessLicenseNumber>$AccessLicenseNumber</AccessLicenseNumber>
    		<UserId>$UserId</UserId>
    		<Password>$Password</Password>
    	</AccessRequest>
    	<?xml version=\"1.0\"?>
    	<RatingServiceSelectionRequest xml:lang=\"en-US\">
    		<Request>
    			<TransactionReference>
    				<CustomerContext>Bare Bones Rate Request</CustomerContext>
    				<XpciVersion>1.0001</XpciVersion>
    			</TransactionReference>
    			<RequestAction>Rate</RequestAction>
    			<RequestOption>Rate</RequestOption>
    		</Request>
    	<PickupType>
    		<Code>01</Code>
    	</PickupType>
    	<Shipment>
    		<Shipper>
    			<Address>
    				<PostalCode>$PostalCode</PostalCode>
    				<CountryCode>US</CountryCode>
    			</Address>
			<ShipperNumber>$ShipperNumber</ShipperNumber>
    		</Shipper>
    		<ShipTo>
    			<Address>
    				<PostalCode>$dest_zip</PostalCode>
    				<CountryCode>US</CountryCode>
				<ResidentialAddressIndicator/>
    			</Address>
    		</ShipTo>
    		<ShipFrom>
    			<Address>
    				<PostalCode>$PostalCode</PostalCode>
    				<CountryCode>US</CountryCode>
    			</Address>
    		</ShipFrom>
    		<Service>
    			<Code>$service</Code>
    		</Service>
    		<Package>
    			<PackagingType>
    				<Code>02</Code>
    			</PackagingType>
    			<Dimensions>
    				<UnitOfMeasurement>
    					<Code>IN</Code>
    				</UnitOfMeasurement>
    				<Length>$length</Length>
    				<Width>$width</Width>
    				<Height>$height</Height>
    			</Dimensions>
    			<PackageWeight>
    				<UnitOfMeasurement>
    					<Code>LBS</Code>
    				</UnitOfMeasurement>
    				<Weight>$weight</Weight>
    			</PackageWeight>
    		</Package>
    	</Shipment>
    	</RatingServiceSelectionRequest>";
    	$ch = curl_init("https://www.ups.com/ups.app/xml/Rate");
    	curl_setopt($ch, CURLOPT_HEADER, 1);
    	curl_setopt($ch,CURLOPT_POST,1);
    	curl_setopt($ch,CURLOPT_TIMEOUT, 60);
    	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
    	curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0);
    	curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0);
    	curl_setopt($ch,CURLOPT_POSTFIELDS,$data);
    	$result=curl_exec ($ch);
	echo '<!-- '. $result. ' -->'; // THIS LINE IS FOR DEBUG PURPOSES ONLY-IT WILL SHOW IN HTML COMMENTS
    	$data = strstr($result, '<?');
    	$xml_parser = xml_parser_create();
    	xml_parse_into_struct($xml_parser, $data, $vals, $index);
    	xml_parser_free($xml_parser);
    	$params = array();
    	$level = array();
    	foreach ($vals as $xml_elem) {
    	 if ($xml_elem['type'] == 'open') {
    	if (array_key_exists('attributes',$xml_elem)) {
    		 list($level[$xml_elem['level']],$extra) = array_values($xml_elem['attributes']);
    	} else {
    		 $level[$xml_elem['level']] = $xml_elem['tag'];
    	}
    	 }
    	 if ($xml_elem['type'] == 'complete') {
    	$start_level = 1;
    	$php_stmt = '$params';
    	while($start_level < $xml_elem['level']) {
    		 $php_stmt .= '[$level['.$start_level.']]';
    		 $start_level++;
    	}
    	$php_stmt .= '[$xml_elem[\'tag\']] = $xml_elem[\'value\'];';
    	eval($php_stmt);
    	 }
    	}
    	curl_close($ch);
    	return $params['RATINGSERVICESELECTIONRESPONSE']['RATEDSHIPMENT']['TOTALCHARGES']['MONETARYVALUE'];
    }
?>
<!-- Add Funtion where you need to get values -->
<?php
include("ups.php");

$service = '03';
$length = '5';
$width = '5';
$height = '5';
$weight = '5';
$dest_zip = '90210';


$rate = ups($dest_zip,$service,$weight,$length,$width,$height);

echo $rate;


?>

Tahnks 🙂

Posted in PHP
%d bloggers like this: