Skip to content

Instantly share code, notes, and snippets.

View hchouhan's full-sized avatar
💡
Thinking

Harish Chouhan hchouhan

💡
Thinking
View GitHub Profile
$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 / 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,
add_filter( 'woocommerce_product_tabs', 'woo_remove_product_tabs', 98 );
function woo_remove_product_tabs( $tabs ) {
unset( $tabs['description'] ); // Remove the description tab
unset( $tabs['reviews'] ); // Remove the reviews tab
unset( $tabs['additional_information'] ); // Remove the additional information tab
return $tabs;
@hchouhan
hchouhan / gravity-forms-snippets
Created March 28, 2014 07:08
Gravity Forms Snippets
<?php
/*
------------------------------------------------------------
Add Additional country to the country select field
------------------------------------------------------------
*/
add_filter("gform_countries", "add_aruba");
@hchouhan
hchouhan / Redirect Users After Login In WordPress
Created April 8, 2014 12:12
Redirect Users After Login In WordPress
<?php
// http://www.paulund.co.uk/redirect-login-wordpress
function redirect_home( $redirect_to, $request, $user )
{
return home_url();
}
add_filter( 'login_redirect', 'redirect_home' );
@hchouhan
hchouhan / example-contact-page-wordpress
Created July 15, 2014 07:12
Example: Contact Us Template Page for WordPress
<?php
/*
Template Name: Contact
*/
?>
<?php
//If the form is submitted
if(isset($_POST['submitted'])) {
<?php
add_shortcode( 'dot_recommended_posts', array( &$this, 'dot_recommended_top_posts' ) );
function dot_recommended_top_posts( $atts, $content = null )
{
// get our variable from $atts
$atts = shortcode_atts( array(
'container' => 'li',
'number' => '10',