Skip to content

Instantly share code, notes, and snippets.

@sareiodata
sareiodata / mysql.txt
Created December 28, 2018 21:20
Possible solution for similar string search
SELECT * FROM `wp_trp_dictionary_en_us_ro_ro` WHERE
MATCH original AGAINST( '“That is why, I suppose, you wished him to go on to Bukovina. You cannot
deceive me, my friend; I know too much, and my horses are swift.” As he
spoke he smiled, and the lamplight fell on a hard-looking mouth, with
very red lips and sharp-looking teeth, as white as ivory. One of my
companions whispered to another the line from Burger’s “Lenore”:—' )
AND
function ginger_parse_dom($output)
{
$ginger_script_tags = array(
'platform.twitter.com/widgets.js',
'apis.google.com/js/plusone.js',
'apis.google.com/js/platform.js',
'connect.facebook.net',
'platform.linkedin.com',
'assets.pinterest.com',
add_filter('trp_before_translate_content', 'trpc_fix_html_attributes_without_spaces');
function trpc_fix_html_attributes_without_spaces($output){
$size = strlen($output);
$pos = 0;
$pos_c = 0;
while ($pos_c < $size){
$len = strcspn($output, '<' , $pos);
<?php
function word_hash($str){
$hash =0;
$str = str_split($str);
foreach($str as $key => $char){
$hash += ord($char) * $key;
}
return $hash;
}
<?php
/*
Plugin Name: Disable Specific Plugins in Dev - translatepress.com
Plugin URI: http://translatepress.com
Description: Disable specified plugins in development environment
Author: TranslatePress
Version: 1.1
Author URI: http://translatepress.com
*/
<?php
/**
* Plugin Name: Easy Digital Downloads - TranslatePress Customizations
* Plugin URI: http://translatepress.com
* Description: TranslatePress customizations for edd
* Version: 1.0.0
* Author: Madalin Ungureanu
*/
@sareiodata
sareiodata / frugal_budget.php
Created October 26, 2016 11:54
load a template for a particular URL
// http://wordpress.stackexchange.com/questions/9870/how-do-you-create-a-virtual-page-in-wordpress
add_action( 'init', 'frugal_add_rewrite_rule' );
function frugal_add_rewrite_rule()
{
add_rewrite_rule( 'budget$', 'index.php?budget=1', 'top' );
}
add_filter( 'query_vars', 'frugal_query_vars' );
function frugal_query_vars( $query_vars )
{
@sareiodata
sareiodata / custom.php
Last active October 24, 2016 14:16
filters for improving user listing SEO stuff
/*
* Make user listing work with the nicename. Tags: user listing, nicename
*/
add_filter('wppb_userlisting_get_user_by_id', create_function('', 'return false;'));
// Filter wp_title for single user listing
function single_user_list_filter_wp_title( $title, $sep ) {
$userID = wppb_get_query_var('username');
@sareiodata
sareiodata / php-html-css-js-minifier.php
Created June 2, 2016 12:56 — forked from taufik-nurrohman/php-html-css-js-minifier.php
PHP Function to Minify HTML, CSS and JavaScript
<?php
/**
* -----------------------------------------------------------------------------------------
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/engine/kernel/converter.php`
* -----------------------------------------------------------------------------------------
*/
// HTML Minifier
function minify_html($input) {
<?php
/**
* The template used for displaying private page content
*
* @package WordPress
* @subpackage Twenty_Sixteen
* @since Twenty Sixteen 1.0
*/
$private_page_class = 'class="type-page ' . join( ' ', get_post_class( $class, $post_id ) ) . '"';