Skip to content

Instantly share code, notes, and snippets.

Avatar

Hiranthi Herlaar hiranthi

View GitHub Profile
@hiranthi
hiranthi / decrypt-2.php
Last active Jan 30, 2019
Encrypt & decrypt Gravity Forms velden
View decrypt-2.php
<?php
# Like on: https://docs.gravityforms.com/gform_get_input_value/
add_filter( 'gform_get_input_value', 'gf_custom_decode_field', 10, 4 );
function gf_custom_decrypt_field( $value, $entry, $field, $input_id )
{
return GFCommon::decrypt( $value );
}
// end gf_custom_decrypt_field
@hiranthi
hiranthi / functions.php
Created Feb 17, 2018
Get current WP sidebar
View functions.php
<?php
if ( ! function_exists( 'get_current_sidebar' ) )
{
function get_current_sidebar ( $widget_id )
{
$sidebars_widgets = get_option('sidebars_widgets', array());
if ( is_array( $sidebars_widgets ) && isset( $sidebars_widgets['array_version'] ) )
unset( $sidebars_widgets['array_version'] );
@hiranthi
hiranthi / functions.php
Created Dec 7, 2017
WordPress image_sizes voor responsive header
View functions.php
<?php
add_action( 'init', 'onx_register_image_sizes' );
function onx_register_image_sizes()
{
add_image_size( 'header_screen_large', 2000, 1200, array( 'center', 'center' ), true );
add_image_size( 'header_screen', 991, 700, array( 'center', 'center' ), true );
add_image_size( 'header_tablet', 767, 550, array( 'center', 'center' ) );
add_image_size( 'header_mobile', 479, 400, array( 'center', 'center' ) );
} // end onx_register_image_sizes
@hiranthi
hiranthi / view-all.php
Last active Aug 29, 2015
View all products of the current category (Shopp)
View view-all.php
<?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 / functions.php
Last active Aug 29, 2015
Put Shopp in maintenance mode, without kicking loggedin users out too.
View functions.php
<?php
new HiddenShopp;
class HiddenShopp
{
/**
* Construct everything
*
* @author Hiranthi Molhoek-Herlaar
@hiranthi
hiranthi / pre-submission-gf.php
Last active Aug 29, 2015
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).
View pre-submission-gf.php
<?php
/**
* Better Pre-submission Confirmation
* http://gravitywiz.com/2012/08/04/better-pre-submission-confirmation/
*/
class GWPreviewConfirmation {
private static $lead;
@hiranthi
hiranthi / breadcrumbs.php
Created Jan 3, 2014
Shopp breadcrumbs with schema.org stuff added.
View breadcrumbs.php
<p>
<?php
$bc = array(
'separator' => '&nbsp;/&nbsp;',
'wrap' => '<p class=”breadcrumb”><span xmlns:v="http://rdf.data-vocabulary.org/#"><span typeof="v:Breadcrumb"><a href="http://liefdevol-opgroeien.nl" rel="v:url" property="v:title">Home</a></span> / ',
'endwrap' => '</p>',
'before' => '<span typeof="v:Breadcrumb"><span property="v:title">',
'after' => '</span></span>'
);
shopp( 'storefront.breadcrumb', $bc );
View gist:7221115
function onx_reset_faceted_menus ()
{
if ( isset( $_GET['reset'] ) && class_exists( 'Shopp' ) )
{
// the part of the Shopp Object that holds the facet filtering info, make it empty
ShoppStorefront()->browsing = array();
// get the current url
$url = explode( '?', onx_full_url() );
View .htaccess
# 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]
@hiranthi
hiranthi / .htaccess
Created Jun 11, 2013
See my post on http://onexa.nl/wordpress/aangepaste-url-voor-wp-admin/ for the use of this code (Dutch website)
View .htaccess
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 -->
You can’t perform that action at this time.