Skip to content

Instantly share code, notes, and snippets.

@redoPop
redoPop / .gitignore
Created June 18, 2010 22:08
Template .gitignore file for WordPress projects
# This is a template .gitignore file for git-managed WordPress projects.
#
# Fact: you don't want WordPress core files, or your server-specific
# configuration files etc., in your project's repository. You just don't.
#
# Solution: stick this file up your repository root (which it assumes is
# also the WordPress root directory) and add exceptions for any plugins,
# themes, and other directories that should be under version control.
#
# See the comments below for more info on how to add exceptions for your
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active May 16, 2024 16:51
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@mikejolley
mikejolley / gist:2044101
Last active May 18, 2021 17:02
WooCommerce - Show number of items in cart and total
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e( 'View your shopping cart' ); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
@g3d
g3d / gist:2709563
Last active February 7, 2024 15:21 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan
@corsonr
corsonr / Add CPTs to search
Created October 13, 2012 09:54
Add CPTs to search
@sbrajesh
sbrajesh / hide-admins-subscribers.php
Created July 1, 2013 20:28
hide admins and subscribers
add_action('bp_ajax_querystring','bpdev_exclude_users',20,2);
function bpdev_exclude_users($qs=false,$object=false){
//list of users to exclude
$excluded_user=join(',', bpdev_get_subscriber_admin_user_ids());//comma separated ids of users whom you want to exclude
if($object!='members')//hide for members only
return $qs;
@opattison
opattison / gallery.html
Last active January 21, 2020 08:11
A Jekyll photo gallery sample, using a for loop in liquid and collections in YAML front matter. This is sort of pseudo-code, but is in a working state in this project: https://github.com/opattison/jeancflanagan 2013-08-13
@kloon
kloon / functions.php
Last active November 26, 2020 02:21
WooCommerce set tax exemption based on user role
<?php
add_filter( 'init', 'wc_tax_exempt_user_roles' );
function wc_tax_exempt_user_roles() {
if ( ! is_admin() ) {
global $woocommerce;
if ( current_user_can('wholesaler') || current_user_can('distributor') ) {
$woocommerce->customer->set_is_vat_exempt(true);
} else {
$woocommerce->customer->set_is_vat_exempt(false);
}
@messaoudi-mounir
messaoudi-mounir / exclude-members-by-roles.php
Last active December 15, 2020 12:42
Buddypress Exclude members by roles
function get_user_ids_by_role($role){
$users=array();
$founded_users = get_users( array( 'role' => $role ) );
if(!empty($founded_users)){
foreach((array)$founded_users as $user)
$users[]=$user->ID;
}
return $users;
}
@freekrai
freekrai / related.class.php
Last active January 4, 2016 03:49
Related Posts without a plugin.