What are benefits of htaccess?

We can do following benefits stuff with htaccess.

  1. Routing the URL
  2. Mange Error Pages for Better SEO
  3. Redirection pages
  4. Detect OS (like Mobile/Laptop/Ios/Android etc)
  5. Set PHP Config variable
  6. Set Environment variable
  7. Allow/Deny visitors by IP Address
  8. Password protection for File/Directory
  9. Optimize Performance of website
  10. Improve Site Security

Disable comments section for a Single Page

You have to follow the below steps to disable comment section for a single page.

  1. Go to Dashboard -> Pages
  2. Select the particular page you want to disable comment.
  3. Click on Screen Options tab and check the box beside Discussion WordPress Screen Options
  4. Now scroll down to the bottom, you will find a discussion section. Uncheck Allow Comments & Allow trackbacks and pingbacks on this page.
  5. And Click Publish/Update

Have any doubt, then comment here!

Advance Happy New Year

As You Log Out Of Last Year
And Login To This New Year,
I Wish To Send You Happy New Year Wishes
Full Of Success, Prosperity, Happiness And Joy.
May This Be A Year Of Change Unto Your Life
May God Give You Protection And Good Health
So That You Live To See Other Years To Come

Get Product id from order id in Woocommerce

If you want to get Product id from order id in Woocommerce then fetch order details.

$order = new WC_Order( $order_id );
$items = $order->get_items();

then if you loop through them, you can get all the relevant data:

foreach ( $items as $item ) {
$product_name = $item['name'];
$product_id = $item['product_id'];
$product_variation_id = $item['variation_id'];
}

Have any doubt, then comment here!

Get list of all woocommerce orders by date

If you want to get list of all woocommerce orders by date then using below code. Here change the value of $your_date by yourself.
Assign particular date to $your_date. This code will return the list of woocommerce orders placed in a particular date.

$your_date = '2016-09-23';
$args = array(
'post_type' => 'shop_order',
'post_status' => 'publish',
'posts_per_page' => -1,
'date_query'=> array(
'after' => $your_date,
'inclusive' => true,
)
);
$orders = get_posts($args);

Have any doubt, then comment here!