Posts

Showing posts from 2017

Add Fancybox in your blog page in shopify

1. Add below js and css in your blog.liquid file: {{ 'jquery.fancybox.js' | asset_url | script_tag }} {{ 'jquery.fancybox.css' | asset_url | stylesheet_tag }} {{ 'jquery.fancybox-thumbs.css' | asset_url | stylesheet_tag }} {{ 'jquery.fancybox-thumbs.js' | asset_url | script_tag }} Add script in same file <script type="text/javascript" charset="utf-8"> $(document).ready(function() {    $('.fancybox').fancybox({             closeBtn  : true,             arrows    : true,             nextClick : true,           }); }); </script> 2. Blog post page: <div class="detail_images"> <p>      <a class="fancybox" href="//cdn.shopify.com/s/files/1/0259/2189/files/9....

Add sidebar custom menu in customize theme shopify

1. config --> data_schema.jason file add following code: Supose you wil add text in headerbar then you will write these code for make dynamic text of headerbar   {     "name": "Header", "settings": [ {         "type": "header",         "content": "Top bar"       },       {         "type": "text",         "id": " header_message1 ",         "label": "Top bar message1",         "info": "Max 55 characters"       },       {         "type": "text",         "id": " header_message2 ",  ...

Application ld json data in shopify

To implement application/ld json in your shopify theme, add following code into your theme.liquid  file.  {% if template == 'product' %}  <script type="application/ld+json">  {"@context":"https://schema.org", "@type":"Product", "name":"{{ product.title }}", "description":"{{ product.description | strip_html | escape }}", "url":"{{ shop.url | append: '/products/' | append: product.handle }}", "brand": {"@type":"Brand", "name":"{{ product.vendor }}", "image":"{{ product.featured_image.src | img_url: 'master'}}", "url":"{{collection_urls}}"}, {% if product.metafields.yotpo.reviews_count and product.metafields.yotpo.reviews_count != "0" %} "aggregateRating":       {"@type":"AggregateR...

Generate Recapcha with PHP

Step 1 : First generate captcha image. Here is php code to generate image with random code. Save it as captcha.php <?php session_start(); $code=rand(1000,9999); $_SESSION["code"]=$code; $im = imagecreatetruecolor(50, 24); $bg = imagecolorallocate($im, 22, 86, 165); //background color blue $fg = imagecolorallocate($im, 255, 255, 255);//text color white imagefill($im, 0, 0, $bg); imagestring($im, 5, 5, 5,  $code, $fg); header("Cache-Control: no-cache, must-revalidate"); header('Content-type: image/png'); imagepng($im); imagedestroy($im); ?> Step 2: First start session to store captcha code in session then generate random code using php rand() function and write it on image generated by imagecreatetruecolor(). Put captcha image in html form: <html> <head> <title>My Login form</title> </head> <body> <form action="validate.php" method="post"> Enter Image Text <input...

Create a Child Theme In Wordpress

Image
Step:1 Create a child theme folder Ø First, create a new folder in your themes directory, located at  wp-content/themes . Ø The directory needs a name. It’s best practice to give a child theme the same name as the parent, but with  -child  appended to the end.  For eg. Parent theme is kickstart then put its chield theme as kickstart-child. Step:2 Create a stylesheet: style.css Ø This tells WordPress basic info about the theme, including the fact that it is a child theme with a particular parent. Ø The following information is required: ·  Theme Name –  needs to be unique to your theme ·  Template –   the name of the parent theme directory Step:3 Create a functions.php file Ø Creating a  functions.php  file is optional. It is only needed if you intend to add additional PHP code to your theme. 

Make carousel slider in shopify

1)  In index.liquid file include following code: add css and js files {{ 'slick.css' | asset_url | stylesheet_tag }} {{ 'slick-theme.css' | asset_url | stylesheet_tag }} {{ 'slick.js' | asset_url | script_tag }} add html part of slider <!--slider start--> <div id="slider">  <!-- Wrapper for carousel items --> <div class="home_slider"> <div>           <a href="{{ settings.slide1_url }}" title="{{ settings[alt] | escape }}"> <img src="{{ 'slide1.jpg' | asset_url }}" class="img-responsive" alt="{{shop.name}}" /></a>               </div>             {% for i in (2..10) %}               {% capture show_slide %}slide-{{ i }}-check{% endcapture %}           ...

Encrypt & Decrypt data using AES algorithm

Ø Encryption: function encrypt($action, $string) {     $output = false;  $encrypt_method = "AES-256-CBC";     $secret_key = 'This is my secret key';     $secret_iv = 'This is my secret iv';  // hash     $key = hash('sha256', $secret_key); // iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning     $iv = substr(hash('sha256', $secret_iv), 0, 16);     $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv);     $output = base64_encode($output);    return $output; } $plain_txt = "This is my plain text"; echo "Plain Text =" .$plain_txt; $encrypted_txt = encrypt('encrypt', $plain_txt); echo "Encrypted Text =". $encrypted_txt; Ø Decryption: function decrypt($action, $string) {     $output = false; $encrypt_method = "AES-256-CBC"...