Skip to content

Instantly share code, notes, and snippets.

@mathetos
mathetos / ssl-for-images.php
Last active July 3, 2018 08:21
Force http/s for images in WordPress
/**
*
* Force http/s for images in WordPress
*
* Source:
* https://core.trac.wordpress.org/ticket/15928#comment:63
*
* @param $url
* @param $post_id
*
@jonathantneal
jonathantneal / README.md
Last active March 19, 2024 23:31
Local SSL websites on macOS Sierra

Local SSL websites on macOS Sierra

These instructions will guide you through the process of setting up local, trusted websites on your own computer.

These instructions are intended to be used on macOS Sierra, but they have been known to work in El Capitan, Yosemite, Mavericks, and Mountain Lion.

NOTE: You may substitute the edit command for nano, vim, or whatever the editor of your choice is. Personally, I forward the edit command to Sublime Text:

alias edit="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
@JDGrimes
JDGrimes / debug-hooks.php
Created February 15, 2014 14:42
WordPress plugin providing some functions to debug actions and filters.
<?php
/**
* Plugin Name: Debug Hooks
* Author: J.D. Grimes & Some other guy on the net
* Version: $ver$
* Description: Adds some functions you can use to debug actions and filters.
*/
/**
@freekrai
freekrai / related.class.php
Last active January 4, 2016 03:49
Related Posts without a plugin.
@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;
}
@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);
}
@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
@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;
@corsonr
corsonr / Add CPTs to search
Created October 13, 2012 09:54
Add CPTs to search
@g3d
g3d / gist:2709563
Last active February 7, 2024 15:21 — forked from saetia/gist:1623487
Clean Install – OS X 10.11 El Capitan