How to create wordpress theme woocommerce supportable

(1) Add following code in functions.php file

function your-theme-name_setup() {
   add_theme_support( 'woocommerce' );
}
add_action( 'after_setup_theme', 'your-theme-name_setup' );

(2)Create a folder “woocommerce” in your theme
(3)Copy template file from “wp-content\plugins\woocommerce\templates” and paste into “wp-content\themes\your-theme-name\woocommerce”

Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  

Post data using curl

$aUrl = '####';
$aData= array('key1' => 'val1','key2' => 'val2');
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($aData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_exec($ch);
curl_close($ch);
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  

Preview and Download Html2Canvas

Here is the code for converting html into canvas.

When we click on Preview button canvas will be show and click on Download canvas will be save in .png format.


<!DOCTYPE html>
<html>
<head>

<!-- include jquery.min.js and html2canvas.js -->
  <script src="jquery/3.1.1/jquery.min.js"></script>
  <script src="jquery/html2canvas.js"></script>

<style>
  #previewBody{
    background-color: #9E9E9E;
    color: #fff;
    padding: 5px 0px 27px 30px;
    width: 46%;
    margin-bottom: 15px;
}
input#PreviewImage {
    margin-bottom: 15px;
}
</style>

<script>
    $(document).ready(function(){
    var getCanvas;
    function callCanvas(){
    html2canvas($("#previewBody"), {
    onrendered: function(canvas) {
    $(".preview_Canvas").html(canvas);
    getCanvas = canvas;
    }
  });
}
   $("#PreviewImage").on('click', function () {
    callCanvas()
    });
   $("#downloadimage").on('click', function () {
      var imgageData = getCanvas.toDataURL("image/png");    
    // Now browser starts downloading it instead of just showing it
    var newData = imgageData.replace(/^data:image\/png/, "data:application/octet-stream");
    $("#downloadimage").attr("download", "your_pic_name.png").attr("href", newData);
  });
});
</script>
</head>
<body>
<div id="previewBody">
  <h2>CANVAS Example</h2>
  <p>Click on preview will show canvas </p>
  <p>Click on download will download the canvas in .png format</p>
   </div>
    
        <input id="PreviewImage" type="button" value="Preview"/>
        <a id="downloadimage" href="#">Download</a>
        <div class="preview_Canvas">
        </div>
</body>
</html>

Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
  
Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.