Skip to content

Instantly share code, notes, and snippets.

View hchouhan's full-sized avatar
💡
Thinking

Harish Chouhan hchouhan

💡
Thinking
View GitHub Profile
@hchouhan
hchouhan / MPI 04
Created October 3, 2013 06:51
MPI 04
if ( empty( $mpi_info ) ) {
/**
* Connect to WordPress.org using plugins_api
* About plugins_api -
* http://wp.tutsplus.com/tutorials/plugins/communicating-with-the-wordpress-org-plugin-api/
*/
require_once ABSPATH . 'wp-admin/includes/plugin-install.php';
$mpi_info = plugins_api( 'plugin_information', array( 'slug' => $slug ) );
@hchouhan
hchouhan / MPI 05
Created October 3, 2013 06:53
MPI -05
if ( $field == "downloaded" ) {
return $mpi_info->downloaded;
}
if ( $field == "name" ) {
return $mpi_info->name;
}
if ( $field == "slug" ) {
return $mpi_info->slug;
@hchouhan
hchouhan / index.html
Created October 18, 2013 17:51 — forked from mfkp/index.html
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="jquery.ketchup.all.min.js" type="text/javascript"></script>
</head>
<body>
<div id="email">
<span>Enter your email to sign up</span>
<form action="/subscribe.php" id="invite" method="POST">
@hchouhan
hchouhan / IRT-Shortcode-ID
Created December 28, 2013 16:38
I Recommend This Plugin: Shortcode with ID supplied
if( function_exists('dot_irecommendthis') ) echo do_shortcode("[dot_recommends id='3801']"); ?>
$post_count = do_shortcode("[dot_recommends ID='$item->ID']");
@hchouhan
hchouhan / create pages in WP
Created March 14, 2014 16:39
Create Pages in WP
/*
* To run the deployment
* 1. Login as an administrator
* 2. Go to http://yourdomain.com/?deploy_changes=1
*/
function deploy_changes() {
// If the request is not our deployment
if ( !isset( $_GET['deploy_changes'] ) ) {
return;
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Register a shortcode that creates a product categories dropdown list
*
* Use: [product_categories_dropdown orderby="title" count="0" hierarchical="0"]
*
@hchouhan
hchouhan / sh-wp-dropdown-taxonomies.php
Last active August 29, 2015 13:57 — forked from stephenh1988/sh-wp-dropdown-taxonomies.php
Walker Class to extend wp_dropdown_categories and allow it to use term's slug as value instead of ID.
<?php
/*
* A walker class to use that extends wp_dropdown_categories and allows it to use the term's slug as a value rather than ID.
*
* See http://core.trac.wordpress.org/ticket/13258
*
* Usage, as normal:
* wp_dropdown_categories($args);
*
@hchouhan
hchouhan / WooCommerce Snippet Product Category Dropdown Widget
Created March 15, 2014 19:18
Widget in Template code to display WooCommerce Product Categories as a dropdown
<?php the_widget( 'WC_Widget_Product_Categories', 'title=&hierarchical=1&orderby=name&dropdown=1' ); ?>
@hchouhan
hchouhan / Display WooCommerce Taxonomy Dropdown
Created March 15, 2014 19:33
Display WooCommerce Taxonomy Dropdown
new SH_Walker_TaxonomyDropdown(),
'value'=>'slug',
'show_option_none' => __('Select a Category', 'dot'),
'taxonomy' => 'product_cat',
'id' => 'product_cat_dropdown',
'name' => 'product_cat',
'orderby' => 'name',
'child_of' => 0,
//'selected' => $wp_query->query['term'],
'hierarchical' => true,