Wednesday, 30 December 2015

Wi-Tribe / Qubee Extra GB (Bundle offer)


Wi-Tribe / Qubee Bundle GB Offers (When you cross GB limit)

In Wi-Tribe when you exceed your GB limit , they charge you Rs. 0.10 Per MB (Rs. 102 Per GB)
In Qubee when you exceed your GB limit, they don't charge you extra and internet works on reduced speed. that usage is free but slow.

Wi-tribe and Qubee both giving their bundle GB offer for their customers.

-- Wi-Tribe Rs. 75 = 2GB , Rs. 150 = 5GB.
-- Qubee Rs.100 = 3GB , Rs. 200 = 7GB or Rs. 500 = 18GB

 (Customer will not be charged even if he wont buy bundle in QUBEE as packages are AOL(Always OnLine) means no extra charge on usage even exceed limit, but speed will be reduced)

New features of Laravel 5 PHP framework

Laravel is one of the highly used and appreciated coding frameworks by the PHP developers. Developers prefer Laravel over to other frameworks because of the performance, features, scalability it offers. Here we will discuss some exceptional features of Laravel that makes it the PHP Developer’s first choice.



Laravel 5 was launched in November 2014. As expected, there were lots of functional changes in the Laravel 5. It was backed with 22 new features for developers. The company has upgraded the successful version of Laravel 5 in the February this year. The latest version of Laravel 5.1 is available now. Laravel 5.0.1 has restructured framework architecture in the latest release. The company has prominently simplified the Method injection. New route-caching feature has been added to Artisan. Let’s have a look over some of the most important features of Laravel 5. 
New directory structure 
It is a structural change that you might notice first. Laravel 5.0.1 implements PSR-4 autolading standards. That means all the classes are fully namespaced now. Config, Storage and Database folders are moved one level up from the App folder in the new structure. Everything else within folder works exactly the same as previous version. They have also added an additional resources folder. This new folder contains all language and template files. 
Method injection 
Method Injection has been significantly simplified in the latest version of Laravel. You had to demand Inversion of Control (IoC) container to provide a class instance until Laravel 4.2. But you can declare the type hinted class instance in the controller method's signature now.
<?php 
class UserController extends BaseController { 
public function _construct(UseRepositoryInterface $users){
$this->users = $users;
} 
}
Developers can do the same using Injection methods by injecting class into method like following:
<?php namespace App\Http\Controllers\Auth; 
use Illuminate\Routing\Controller;
use Illuminate\Contracts\Auth\Authenticator; 
use App\http\Requests\Auth\registerRequest; 
class AuthController extends Controller{
public function _constuct(Authenticator $auth)
{
$this->auth = $auth;
}
public function postRegister(RegisterRequest $request)
{
$this->auth->login($user);
return redirect('/');
}          
}
Contracts
Contract is basically a set of interfaces that defines the core services. If you need caching in package, you can achieve that using Illuminate\Contacts\cache. You can do cache programing anywhere in the code using the concrete cache class without changing the package code. All these happen in the Application.php file under Illuminate\Foundation\folder.
Route caching
Route caching feature speeds up the application route registration. This feature is perfectly suitable for you if your application has a large number of routes. You can use PHP artisan route: cache and PHP artisan route:clear commands to turn ON and OFF the route catching in the program. It is generally implemented as a part of deployment process.
Authentication
Authentication is the most important part of any web application and developers spent enormous time writing the authentication code. Authentication has become simpler with this update in Laravel 5. Laravel 5 contains the ready to use inbuilt authentication system. You just need to configure database migrations, models, controllers and views to make the system work.
Events object
Developers were enforced to declare application events as a string until now. But you can declare new events in the application using “event object” using Laravel 5.  You can create event objects using php artisan make:event <event-name> and event header object using php artisan handler:event <handler-name>. You can fire the events using Event::fire(new Event(params)) once you create any new event.
Multiple file system
Laravel 5 provides the native support for multiple file system. Laravel uses third party package Flysystem to provide multiple file support. You can use any of Local or Cloud based storage to provide simple configuration. You can configure storage options in config/filesystems.php file. You can also bypass all file system facade in the application and work directly disk facade.

These are some of the most advance features of Laravel 5. There are some other features as well. For example, Queue and Task Scheduling, Request Object, Laravel Socialite, Commands etc. Laravel 5 has improved a lot from the architectural perspective. It also works seamlessly for code organization and maintenance. You can install laravel 5 from here

Monday, 21 December 2015

Load more posts on click using jQuery

DEMO: https://jsfiddle.net/gmkhussain/hd4603gj/

HTML=========
<h2>Load More Posts</h2>

<div id="allpost">

<div class="post-box" id="hari1">
             <div class="post-img col-sm-3">
                            <img width="155" height="136" src="http://localhost/projects/summer-blog/wp-content/uploads/2015/12/image1-1.jpg" class="attachment-full size-full wp-post-image" alt="image1">                                                        </div>
       <div class="post-content col-sm-9">
            <h3>Fifth Blog Heading Goes Here</h3>
                                 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate…         <!--<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim.</p>
         <p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae justo Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum sempjr niig</p>-->
            <span class="date pul-lft">21 December, 2015<!--14 August, 2015--></span>
         <span class="readmore pul-rgt"><a href="http://localhost/projects/summer-blog/2015/12/21/fifth-blog-heading-goes-here/">Read More</a></span>  
       </div>
        </div>
        
        <div class="post-box" id="hari1">
             <div class="post-img col-sm-3">
                            <img width="155" height="136" src="http://localhost/projects/summer-blog/wp-content/uploads/2015/12/image1-1.jpg" class="attachment-full size-full wp-post-image" alt="image1">                                                        </div>
       <div class="post-content col-sm-9">
            <h3>Fifth Blog Heading Goes Here</h3>
                                 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate…         <!--<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim.</p>
         <p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae justo Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum sempjr niig</p>-->
            <span class="date pul-lft">21 December, 2015<!--14 August, 2015--></span>
         <span class="readmore pul-rgt"><a href="http://localhost/projects/summer-blog/2015/12/21/fifth-blog-heading-goes-here/">Read More</a></span>  
       </div>
        </div>
        
        <div class="post-box" id="hari1">
             <div class="post-img col-sm-3">
                            <img width="155" height="136" src="http://localhost/projects/summer-blog/wp-content/uploads/2015/12/image1-1.jpg" class="attachment-full size-full wp-post-image" alt="image1">                                                        </div>
       <div class="post-content col-sm-9">
            <h3>Fifth Blog Heading Goes Here</h3>
                                 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate…         <!--<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim.</p>
         <p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae justo Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum sempjr niig</p>-->
            <span class="date pul-lft">21 December, 2015<!--14 August, 2015--></span>
         <span class="readmore pul-rgt"><a href="http://localhost/projects/summer-blog/2015/12/21/fifth-blog-heading-goes-here/">Read More</a></span>  
       </div>
        </div>
        
        
        <div class="post-box" id="hari1">
             <div class="post-img col-sm-3">
                            <img width="155" height="136" src="http://localhost/projects/summer-blog/wp-content/uploads/2015/12/image1-1.jpg" class="attachment-full size-full wp-post-image" alt="image1">                                                        </div>
       <div class="post-content col-sm-9">
            <h3>Fifth Blog Heading Goes Here</h3>
                                 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate…         <!--<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim.</p>
         <p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae justo Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum sempjr niig</p>-->
            <span class="date pul-lft">21 December, 2015<!--14 August, 2015--></span>
         <span class="readmore pul-rgt"><a href="http://localhost/projects/summer-blog/2015/12/21/fifth-blog-heading-goes-here/">Read More</a></span>  
       </div>
        </div>
        
        
        <div class="post-box" id="hari1">
             <div class="post-img col-sm-3">
                            <img width="155" height="136" src="http://localhost/projects/summer-blog/wp-content/uploads/2015/12/image1-1.jpg" class="attachment-full size-full wp-post-image" alt="image1">                                                        </div>
       <div class="post-content col-sm-9">
            <h3>Fifth Blog Heading Goes Here</h3>
                                 Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate…         <!--<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque natibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec pellentesque eu pretium uis, sem. Nulla consequat massa quis enim.</p>
         <p>Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae justo Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum sempjr niig</p>-->
            <span class="date pul-lft">21 December, 2015<!--14 August, 2015--></span>
         <span class="readmore pul-rgt"><a href="http://localhost/projects/summer-blog/2015/12/21/fifth-blog-heading-goes-here/">Read More</a></span>  
       </div>
        </div>
        
        
        <div class="loadmore">Load More</div>
        

        </div>







CSS======

<style>
.post-box {
    border: 1px solid #39c;
    margin: 0 0 20px;
    padding: 20px;
    display:block;
}
.notvis {background-color:#eee; display:none;}

.post-box:nth-child(1), .post-box:nth-child(2) {
    display: block;
}

.loadmore {
    background-color: #39c;
    color: #fff;
    padding: 20px;
    width: 140px;
    text-align: center;
    border-radius: 30px;
    float: none;
    margin: 0 auto;

}
</style>











JS==========

<script>
$(document).ready(function () {
$(".post-box").addClass("notvis"); 
total = $("#allpost .post-box").size();
x = 2;
//alert("total"+ total);

    $('.loadmore').click(function () {
       //y = x;
        $(total);
        alert(x);
    $(".post-box").removeClass("notvis");     
$(".post-box:gt("+x+")").addClass("notvis"); 
     x = x + 1;
    });
});
</script>

Thursday, 17 December 2015

remove span elements from Contact form 7 but keeping inside elements

//remove span elements from Contact form 7 but keeping inside elements

var cf7input = $( ".wpcf7-form-control" );
  if ( cf7input.parent().is( "span" ) ) {
    cf7input.unwrap();
  } else {
    cf7input.wrap( "<span></span>" );








 



jQuery('.form-group br').remove();


 

//On focus add class for animation (optional)
jQuery('.form-control').focusout(function(){
 var text_value=jQuery(this).val();
     if(text_value!='')
       {

//alert(1);
jQuery(this).addClass("wariya");
        }else{jQuery(this).removeClass("wariya");}
});



DEMO: https://jsfiddle.net/qjw5nr7r/

Wednesday, 16 December 2015

How to display post featured image and content call by Post ID WordPress

<?php $post = get_post(159); setup_postdata($post);?>
<p><?php  the_content();?></p>

<?php the_post_thumbnail(); ?>

how to create and display categories for post type in WordPress

/******services_posttype***********/
function args_ourwork_posttype(){
   $args_services = array(
   'labels'=> array( 'name'=>'ourwork Tab',
       'singular_name'=> 'ourwork',
       'menu_name'=>'ourwork',
       'name_admin_bar'=> 'ourwork',
       'all_items' =>'View all ourwork',
       'add_new'=> 'Add New ourwork' ),
   'description' =>"This post type is for ourwork",
   'public' => true,
   'exclude_from_search'=>false,
   'publicly_queryable'=> true,
   'show_ui' => true,
   'show_in_menu'=> true,
   'show_in_admin_bar'=> true,
   'menu_position'=>6,
   'capability_type'=> 'page',
   'menu_icon' => get_stylesheet_directory_uri().'/images/dash-logos.png',
   'supports'=> array( 'title', 'editor', 'author', 'thumbnail', 'excerpt',
    ),
   'query_var'=>true,
  );

register_post_type( "ourwork", $args_services );
    $categories_labels = array(
        'label' => 'ourwork Category',
        'hierarchical' => true,
        'query_var' => true
    );
    register_taxonomy('ourwork_categories', 'ourwork', $categories_labels);

 }

 add_action("init","args_ourwork_posttype");
/******./args_services_posttype**********/








==========================







<?php

 $args = array(
 'post_type'=> 'ourwork',
 'tax_query' => array(
  array(
   'taxonomy' => 'ourwork_categories',
   'field' => 'slug',
   'terms' => 'all'
  )
 )
);

$my_query = new WP_Query($args);
//$postslist = get_posts( $args_args );
//var_dump($postslist);

//exit;
if( $my_query->have_posts() ) {
  while ($my_query->have_posts()) : $my_query->the_post(); ?>
           

<div class="tab-img col-sm-3">
                 <?php the_post_thumbnail('full'); ?>
  <div class="tab-hover text-center">
  <img src="<?php echo get_stylesheet_directory_uri();?>/images/eyehover.png">
  <div class="link-hover"><?php the_content();?></div>
  </div>
</div>

                   <?php
  endwhile;
}
wp_reset_query();  // Restore global post data stomped by the_post().
?>
       

Thursday, 10 December 2015

Automatic Deployment Bitbucket (git) to live site

Hostgator has git and svn preinstalled. This enables us to automate deployment! The end result is when you push a commit to bitbucket, the changes are automatically deployed your site… automatically.
For this tutorial I will assume you have
  1. Bitbucket account
  2. Your git repo already uploaded to Bitbucket
  3. sourcetree git client managing your local git repo
  4. root access to your hostgator
  5. SSH access
My bitbucket account is bruceoutdoors, and I’ll be using a private git repo deploy-test.

Set up SSH in hostgator

After you have logged in to the cpanel, use your legacy file manager and set it to home directory and show hidden files.
Create a new .ssh folder if it has not existed.
Download PuTTy if haven’t got it. NOTE: To paste contents to PuTTy, right click on the terminal. Enter something like:
Hostname: gator1111.hostgator.com:1111
Port: 2222
Click “Open”. Login into hostgator with your username and password
run:
cd .ssh
ssh-keygen
We won’t be using any passphrase, so press enter until the SSH Key is generated. This should generate 2 files:
  • id_rsa – private key
  • id_rsa.pub – public key
Create a new file in your .ssh/ directory and name it authorized_keys.
Copy paste the contents of id_rsa.pub inside.
Configure your site’s repo to use SSH instead of HTTPS
Deploy your git repository to your server.
Edit your .git/config in your site directory, change
url = https://bruceoutdoors@bitbucket.org/bruceoutdoors/deploy-test.git
to
url = ssh://git@bitbucket.org/bruceoutdoors/deploy-test.git

Install the public key on your Bitbucket account

Open a browser and log into Bitbucket.
Choose avatar > Manage Account from the menu bar.
The system displays the Account settings page.
Click SSH keys.
The SSH Keys page displays. It shows a list of any existing keys. Then, below that, a dialog for labeling and entering a new key.
copy the contents of the public key file id_rsa.pub.
Back in your browser, enter a Label for your new key, for example, Default public key.
Paste the copied public key into the SSH Key field.
Click the Add key button.
The system adds the key to your account.
Return to PuTTy and verify your configuration by entering the following command:
ssh -T git@bitbucket.org
It should ask you
The authenticity of host ‘bitbucket.org (111.113.10.161)’ can’t be established.
RSA key fingerprint is 11:8p:5b:f2:6f:14:6q:1t:1r:ec:aa:11:11:14:7c:40.
Are you sure you want to continue connecting (yes/no)?
type yes and press enter:
Warning: Permanently added ‘bitbucket.org,111.113.10.161’ (RSA) to the list of known hosts.
logged in as bruceoutdoors.
You can use git or hg to connect to Bitbucket. Shell access is disabled.
This will add a “known_hosts” file in ~/.shh/ in hostgator
This is how your .ssh directory will look like now:

PHP Auto Deploy Script
We will now create a php script that will execute the git pull command without us needing to log into hostgator.
Create a file “git-hook.php” in your site repository with the following contents
1
2
3
4
5
6
<?php
echo "<b>Attempting to pull from git repo...</b> <br>";
exec('git pull'$output);
foreach ($output as $o) {
    echo $o '<br>';
}
If you go to the URL of your site, it should output something like:
Attempting to pull from git repo...
 Already up-to-date.
Now to set up hooks so that every time a commit is pushed, it’s changes are automatically reflected in our site.
POST Hooks
In Bitbucket, in your repository settings, Select Hooks. Add a POST hook and enter the URL of your git-hook.php script. It should look like this when you’re done:

Now every time you push a commit to bitbucket’s repo, it will automatically deploy your changes.

how to display woocommerce recent products on wordpress custom page

<section id="recentProductArea">
 <div class="container">
    <h1>Recently Added</h1>

  <div class="products-area">
        <?php
            $args = array( 'post_type' => 'product', 'stock' => 1, 'posts_per_page' => 4, 'orderby' =>'date','order' => 'DESC' );
            $loop = new WP_Query( $args );
            while ( $loop->have_posts() ) : $loop->the_post(); global $product; ?>
                    <div class="product-box col-sm-3">    

      <a id="id-<?php the_id(); ?>" href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
                            <?php if (has_post_thumbnail( $loop->post->ID )) echo get_the_post_thumbnail($loop->post->ID, 'shop_catalog'); else echo '<img src="'.woocommerce_placeholder_img_src().'" alt="Placeholder" width="65px" height="115px" />'; ?>
                            <h3><?php the_title(); ?></h3>
                            <span class="price"><?php echo $product->get_price_html(); ?></span>
                        </a>

                        <?php woocommerce_template_loop_add_to_cart( $loop->post, $product ); ?>
                    </div>
        <?php endwhile; ?>
        <?php wp_reset_query(); ?>
  </div>
 </div>
</section>

Alternative content