Skip to content

Instantly share code, notes, and snippets.

View dasbairagya's full-sized avatar
🎯
Focusing

Gopal Dasbariagya dasbairagya

🎯
Focusing
View GitHub Profile
@dasbairagya
dasbairagya / jQuery-autocomplete.php
Last active January 2, 2017 05:36
JQuery autocomplete input-field by term-taxonomy.
<?php
/**
* Template Name: Test
* Created by PhpStorm.
* User: PC35
* Date: 23-12-2016
* Time: 10:32
*/
?>
@dasbairagya
dasbairagya / live-templates.php
Last active January 2, 2017 12:54
Phpstrom live templates
Abbreviation: cpt
Description: custom post type
<?php
/**
* Register Post Type $cpt$
*/
add_action( 'init', 'codex_$cpt$_init' );
function codex_$cpt$_init() {
@dasbairagya
dasbairagya / posts.php
Created January 2, 2017 13:18
get a list of posts from Custom Taxonomy
<?php
$terms = get_terms( array(
'taxonomy' => 'taxonomy_name',
'hide_empty' => false,
) );
//from the above code you will get the term id;
$args = array(
'post_type' => 'product',
@dasbairagya
dasbairagya / form.html
Last active January 9, 2017 12:29
Submit html form using Ajax with loader
<html>
<head>
<title>Insert data in the database using Ajax</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<style>/* Absolute Center Spinner */
.success{
color:green;
font-size:20px;
border:1px solid green;
padding: 8px;
@dasbairagya
dasbairagya / index.php
Last active January 20, 2017 21:28
Dynamically create active class within loop
<div class="carousel-inner" role="listbox">
<?php
$c = 0;
$class = '';
query_posts('category_name=slider&showposts=3');
if ( have_posts() ) : while ( have_posts() ) : the_post();
$c++;
$thumb = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'thumbnail' );
@dasbairagya
dasbairagya / file_upload.php
Last active January 20, 2017 21:34
Custom plugin for file upload and view
<?php
/*
Plugin Name: CV
Plugin URI: http://Gowebbi.com/
Description: CV
Author:
Version: 1.0
Author URI: http://Gowebbi.com/
*/
add_action('admin_menu', 'wp_show_summery');
@dasbairagya
dasbairagya / redme.txt
Created January 20, 2017 21:52
what is json?
JSON IS NOTHING BUT AN ARRAY OF OBJECTS.
OBJECT:
var myCar = {
"name": "Audi",
"model": "AU-300",
"color": "Red"
}
var myColor = {
@dasbairagya
dasbairagya / index.html
Last active January 20, 2017 22:11
JSON API WITH AJAX
<!DOCTYPE html>
<html>
<head>
<title>json and ajax</title>
<style type="text/css">
.hide-me{
display: none;
}
</style>
</head>
@dasbairagya
dasbairagya / paginate.php
Created January 22, 2017 16:41
paginate_links()
<?php $loop = new WP_Query(array('post_type' => 'portfolio', 'posts_per_page' => get_option('to_count_portfolio'), 'paged' => get_query_var('paged') ? get_query_var('paged') : 1 )
); ?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<span class="title"><?php the_title(); ?></span></br>
<?php endwhile; ?>
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
@dasbairagya
dasbairagya / car-search.php
Created January 22, 2017 17:23
seattleshuttlex-search page
<?php
/*
Template Name: Car Search
*/
error_reporting(0);
get_header('inner');
if($_POST['btn_submit']) {
$service = $_POST['select1'];
$zipcode = $_POST['select3'];