Skip to content

Instantly share code, notes, and snippets.

View hiranthi's full-sized avatar

Hiranthi Herlaar hiranthi

View GitHub Profile
@hiranthi
hiranthi / pre-submission-gf.php
Last active August 29, 2015 13:57
The "Better Pre-submission Confirmation" from Gravity Wiz, with a few adjustments (support for Gravitate Encryption and a little adjustment on the Order (products) table).
<?php
/**
* Better Pre-submission Confirmation
* http://gravitywiz.com/2012/08/04/better-pre-submission-confirmation/
*/
class GWPreviewConfirmation {
private static $lead;
@hiranthi
hiranthi / functions.php
Last active August 29, 2015 14:01
Put Shopp in maintenance mode, without kicking loggedin users out too.
<?php
new HiddenShopp;
class HiddenShopp
{
/**
* Construct everything
*
* @author Hiranthi Molhoek-Herlaar
@hiranthi
hiranthi / view-all.php
Last active August 29, 2015 14:06
View all products of the current category (Shopp)
<?php
/**
* Filter $load_options
*/
function onx_custom_filter($load_options)
{
if ( is_admin() ) return $load_options;
if ( isset($_REQUEST['viewall']) || isset($_REQUEST['view-all']) )
@hiranthi
hiranthi / customize-wishlist-button.php
Last active December 14, 2015 01:09
Customizing the placement of the "add-to-wishlist" button/link for the Wishlist Pro plugin for Shopp.
<?php
/**
* Disable auto-placement of "add to wishlist buttons/links"
*/
function custom_sw_shopp_init()
{
$sw = new ShoppWishlist()
remove_filter('shopp_product_description',array(&$sw, 'button_product'), 99); // disable the auto-placement in product description
@hiranthi
hiranthi / account-link.php
Created February 21, 2013 11:11
Get the "Wishlist" link (Wishlist Pro plugin for Shopp).
@hiranthi
hiranthi / ajax.js
Last active December 14, 2015 02:29
Adding products to the wishlist through AJAX so customers don't leave the current page (for Shopp - Wishlist Pro from Shopplugin.nl).
jQuery(document).ready(function($) {
// the add-to-wishlist links should be inside an id="edit-wishlist-pro", ie a div or a span
$('#edit-wishlist-pro a').click(function(e) {
e.preventDefault();
// the surrounding grandparent should have a rel attached that holds the ID of the product (ie rel="12")
var product = $(this).parent().parent().attr('rel');
// the parent (<p>) doesn't have a 'remove' class, so we're adding to the wishlist
@hiranthi
hiranthi / autoembed.php
Created March 4, 2013 11:34
Add autoembed functionality to Shopp product description & summary
<?php
global $wp_embed;
add_filter( 'shopp_product_description', array( $wp_embed, 'autoembed' ), 999 );
add_filter( 'shopp_product_summary', array( $wp_embed, 'autoembed' ), 999 );
?>
@hiranthi
hiranthi / add2wishlist-cart.php
Created April 9, 2013 08:31
Add a product to the wishlist from the cart page.
<?php
// load product, should be inside the cartitem loop
shopp('storefront','product','load=true&id=' . shopp('cartitem','product','return=true'));
// then place the add-to-wishlist link/checkbox where you want it -> inside that same loop (options below)
shopp('wishlist-pro','add-button','options');
// Options:
# type - link | checkbox
# before - add something before the link/checkbox
@hiranthi
hiranthi / .htaccess
Created June 11, 2013 10:15
See my post on http://onexa.nl/wordpress/aangepaste-url-voor-wp-admin/ for the use of this code (Dutch website)
RewriteEngine on
RewriteBase /
# WP automatically redirects domain.com/admin to the correct wp-admin URL, we want to stop this so we're sending the visitor to the homepage
RewriteRule ^admin/?(.*?) http://www.domain.com [R=301,L]
# Cloaking the wp-admin folder and changing it to domain.com/my-administration/
RewriteRule ^my-administration/(.*?) wp-admin/$1?%{QUERY_STRING} [L]
# Default WP stuff goes here -->
# Place this below the .htaccess code from https://onexa.nl/nieuwsberichten/brute-force-attacks-wp-login-php-verminderen/
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{QUERY_STRING} !(^|&)secure=XXXXXXXXX($|&)
RewriteCond %{REQUEST_URI} .wp-admin* [OR]
RewriteCond %{REQUEST_URI} .wp-login\.php*
RewriteCond %{HTTP_REFERER} !.*domain.com.* [OR]
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule (.*) http://%{REMOTE_ADDR}/ [R=301,L]