Saturday 11 February 2017

Easy Code for create folder to zip folder in php

<?php
function Zip($source, $destination)
{
    if (!extension_loaded('zip') || !file_exists($source)) {
        return false;
    }

    $zip = new ZipArchive();
    if (!$zip->open($destination, ZIPARCHIVE::CREATE)) {
        return false;
    }

Auto hide placeholder text on focus on text field.

 it's so simple to remove placeholder text on focus on text field
        and get it back on blur if no text write inside text field.

        we use two function onfocus and onblur to do this.see below Example:

Friday 10 February 2017

Add your own custom jquery in magento 2

 When using custom jquery then not need add cdn jquery library link.Because by default in magneto 2 added jquery library links.
 
require(['jquery'],function($){
    $(window).load(function() {
       <!----code---->
    });
});



Set pagination codding in wp posts Wordpress

WordPress has the ability to split lists of posts or a single post into multiple pages for "paged" navigation.

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$loop = new WP_Query( array(
'post_type' => 'post_type',
'posts_per_page' => 4,
'orderby'=> 'orderBy_attribute',
'paged'=>$paged
) );


Example:

Thursday 9 February 2017

Very easy way Upload File Using PHP

File uploading using php is very simple, follow this step by step tutorial to upload file


Make a Form First
    <form action="" method="post" enctype="multipart/form-data">
        <input type="file" name="upload_file">
        <input type="submit" name="submit">
    </form>
   

Easy and important git commands - GitHub



Here is a list of some basic Git commands to get you going with Git.

 

Since Git was designed with a big project like Linux in mind, there are a lot of Git commands. However, to use the basics of Git, you’ll only need to know a few terms. They all begin the same way, with the word “git.”


Wednesday 8 February 2017

Combined the tax_query and Meta _query of wordpress

WP_Query is a class defined in wp-includes/query.php that deals with the intricacies of a post's (or page's) request to a WordPress blog.

TAX_Query is Creating a taxonomy generally automatically creates a special query variable.which we can use to retrieve posts based on.

Use both the meta_query and the tax_query


Thursday 2 February 2017

Mysql Database connection in php

 Before you can get content out of your MySQL database, you must know how to establish a connection to MySQL from inside a PHP script. To perform basic queries from within MySQL is very easy. This article will show you how to get up and running.

Let's get started. The first thing to do is connect to the database.The function to connect to MySQL is called mysql_connect. This function returns a resource which is a pointer to the database connection. It's also called a database handle, and we'll use it in later functions. Don't forget to replace your connection details.