Skip to content

Instantly share code, notes, and snippets.

View psahalot's full-sized avatar

Puneet Sahalot psahalot

View GitHub Profile
@psahalot
psahalot / BizLife call to action
Created October 11, 2012 10:22
Call to action button for BizLife
<a href="http://icustomizethesis.com/contact/" class="action-button">Hire Me</a>
@psahalot
psahalot / Read more button
Created October 11, 2012 10:24
Read more button for BizLife Skin
<a href="your-url" class="rm-button">Read More</a>
@psahalot
psahalot / CenterCenter align read more button
Created October 11, 2012 10:25
Center align read more button BizLife Skin
<p style="text-align:center;"><a href="your-url" class="rm-button">Read More</a></p>
@psahalot
psahalot / Drupal to WP
Created October 16, 2012 19:13
SQL queries for importing Drupal 6.x content to WordPress
# DRUPAL-TO-WORDPRESS CONVERSION SCRIPT
# Changelog
# 07.29.2010 - Updated by Scott Anderson / Room 34 Creative Services http://blog.room34.com/archives/4530
# 02.06.2009 - Updated by Mike Smullin http://www.mikesmullin.com/development/migrate-convert-import-drupal-5-to-wordpress-27/
# 05.15.2007 - Updated by D’Arcy Norman http://www.darcynorman.net/2007/05/15/how-to-migrate-from-drupal-5-to-wordpress-2/
# 05.19.2006 - Created by Dave Dash http://spindrop.us/2006/05/19/migrating-from-drupal-47-to-wordpress/
# This assumes that WordPress and Drupal are in separate databases, named 'wordpress' and 'drupal'.
@psahalot
psahalot / Amazon EC2 + WP
Created October 20, 2012 05:50
Installing and running WordPress on Amazon EC2
// switch to root user
sudo su
// install Apache
apt-get install apache2
// install PHP and related modules
apt-get install php5
apt-get install libapache2-mod-php5
<?php
/*
This file is for skin specific customizations. Be careful not to change your skin's skin.php file as that will be upgraded in the future and your work will be lost.
If you are more comfortable with PHP, we recommend using the super powerful Thesis Box system to create elements that you can interact with in the Thesis HTML Editor.
*/
add_action("gform_post_submission", "set_post_content", 10, 2);
function set_post_content($entry, $form)
{
@psahalot
psahalot / Gzip
Created August 5, 2014 19:42
Gzip for IB post
<ifModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file .(html?|txt|css|js|php|pl)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>
@psahalot
psahalot / Add to Cart with Qty Input
Created November 14, 2014 04:28
WooCommerce Add to Cart with AJAX Quantity Input
<?php
// Display an "Add to cart" Button along with "Quantity" input
// for WooCommerce products using a custom Loop
// Reference: https://gist.github.com/webaware/6260468
global $product;
// not for variable, grouped or external products
@psahalot
psahalot / Hide out of stock - Category Archive
Last active August 29, 2015 14:25
Hide out of stock products from category archives in WooCommerce
<?php
// Do not include the opening tag
add_action( 'pre_get_posts', 'custom_pre_get_posts_query' );
function custom_pre_get_posts_query( $q ) {
if ( ! $q->is_main_query() ) return;
if ( ! $q->is_post_type_archive() ) return;
if ( ! is_admin() ) {
@psahalot
psahalot / skip-to-check-out.php
Created October 20, 2015 21:12 — forked from micc83/skip-to-check-out.php
Skip cart and redirect to direct checkout on WooCommerce
<?php
/**
* Skip cart and redirect to direct checkout
*
* @package WooCommerce
* @version 1.0.0
* @author Alessandro Benoit
*/
// Skip the cart and redirect to check out url when clicking on Add to cart