Skip to content

Instantly share code, notes, and snippets.

View remcotolsma's full-sized avatar
🏢
Working @pronamic

Remco Tolsma remcotolsma

🏢
Working @pronamic
View GitHub Profile
@remcotolsma
remcotolsma / xmlsec.class.php
Created September 19, 2013 18:24
This class can be used to encrypt, decrypt, sign and verify data in XML documents using the XMLSec standards. It uses the XMLSec library tools developed by Aleksey Sanin and others to perform the basic cryptographic operations on XML documents to comply with the W3 Consortium XMLSec standards: http://www.w3.org/TR/xmlenc-core/ http://www.w3.org/…
<?
/*
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
SELECT
CONCAT(
'UPDATE wp_posts SET post_content = REPLACE(post_content, ' ,
QUOTE(meta.meta_value) , ', ' ,
QUOTE(post.guid) , ');'
)
FROM
wp_posts AS post
RIGHT JOIN
wp_postmeta AS meta
@remcotolsma
remcotolsma / gist:6493015
Created September 9, 2013 08:38
WordPress function/action to exclude comment type in comment count.
<?php
/**
* Update comment count
*
* @see https://github.com/WordPress/WordPress/blob/3.6/wp-includes/comment.php#L1620
*/
function prefix_update_comment_count( $post_id ) {
global $wpdb;
@remcotolsma
remcotolsma / gist:6460871
Created September 6, 2013 08:05
Example of WordPress action for WordPress User Query filter on author of specific post type. https://gist.github.com/remcotolsma/6460846
<?php
$user_query = new WP_User_Query( array(
'orderby' => 'ID',
'prefix_post_type' => 'blog'
) );
$users = $user_query->get_results();
foreach ( $users as $user ) {
@remcotolsma
remcotolsma / gist:6460846
Last active December 22, 2015 10:48
WordPress action for WordPress User Query filter on author of specific post type.
<?php
/**
* User query post type
*
* @param WP_User_Query $query
* @see https://github.com/WordPress/WordPress/blob/3.6/wp-includes/user.php#L528
*/
function prefix_user_query_post_type( $query ) {
global $wpdb;
@remcotolsma
remcotolsma / gist:6228437
Created August 14, 2013 06:11
Adjust WooCommerce gateway icon with the WooCommerce 'woocommerce_available_payment_gateways' filter.
<?php
function prefix_pronamic_ideal_gateway_icon( $gateways ) {
if ( isset( $gateways['pronamic_ideal'] ) ) {
$gateways['pronamic_ideal']->icon = get_stylesheet_directory_uri() . '/images/omnikassa.png';
}
return $gateways;
}
@remcotolsma
remcotolsma / gist:6131041
Created August 1, 2013 12:51
Insert WordPress redirection items for the Redirection plugin (http://wordpress.org/plugins/redirection/) from WordPress post meta imported URL.
INSERT
INTO wp_redirection_items (
url ,
group_id ,
action_type ,
action_code ,
action_data ,
match_type
)
SELECT
@remcotolsma
remcotolsma / gist:6103897
Last active July 19, 2018 21:19
Analytics tracking code per language (WPML)
<?php
/**
* Google Analytics tracking code per language (WPML)
*
* @param array $options
* @see http://plugins.trac.wordpress.org/browser/google-analytics-for-wordpress/tags/4.3.3/frontend/class-frontend.php#L12
*/
function prefix_ga_init( $options ) {
global $yoast_ga;
@remcotolsma
remcotolsma / gist:5884430
Last active February 23, 2023 01:27
Gravity Forms calculate number days between 2 date fields
<script type="text/javascript">
jQuery( document ).ready( function( $ ) {
var ms_one_day = 1000 * 60 * 60 * 24;
var form_id = '1';
var date_format = 'dd-mm-yy';
var field_date_start = $( '#input_' + form_id + '_1' );
var field_date_end = $( '#input_' + form_id + '_2' );
@remcotolsma
remcotolsma / jquery-ui-1.10.3.custom.min.js
Created May 7, 2013 09:33
Gravity Forms + Custom Post Types - fix has no method 'curCSS' - jquery-ui-1.10.3.custom.min.js
/*! jQuery UI - v1.10.3 - 2013-05-07
* http://jqueryui.com
* Includes: jquery.ui.core.js, jquery.ui.widget.js, jquery.ui.mouse.js, jquery.ui.position.js, jquery.ui.autocomplete.js, jquery.ui.menu.js
* Copyright 2013 jQuery Foundation and other contributors Licensed MIT */
(function(e,t){function i(t,i){var a,n,r,o=t.nodeName.toLowerCase();return"area"===o?(a=t.parentNode,n=a.name,t.href&&n&&"map"===a.nodeName.toLowerCase()?(r=e("img[usemap=#"+n+"]")[0],!!r&&s(r)):!1):(/input|select|textarea|button|object/.test(o)?!t.disabled:"a"===o?t.href||i:i)&&s(t)}function s(t){return e.expr.filters.visible(t)&&!e(t).parents().addBack().filter(function(){return"hidden"===e.css(this,"visibility")}).length}var a=0,n=/^ui-id-\d+$/;e.ui=e.ui||{},e.extend(e.ui,{version:"1.10.3",keyCode:{BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,NUMPAD_ADD:107,NUMPAD_DECIMAL:110,NUMPAD_DIVIDE:111,NUMPAD_ENTER:108,NUMPAD_MULTIPLY:106,NUMPAD_SUBTRACT:109,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32