Skip to content

Instantly share code, notes, and snippets.

@j4ckth3r1pp3r
j4ckth3r1pp3r / wp_insert_rows_and_update_postmeta.php
Created November 30, 2017 10:09
wp_insert_rows not my function, but "wp_update_postmeta_rows" is mine. wp_update_postmeta_rows allows you to bulk add or update postmeta with one sql request
<?php
/**
* A method for inserting multiple rows into the specified table
* Updated to include the ability to Update existing rows by primary key
*
* Usage Example for insert:
*
* $insert_arrays = array();
* foreach($assets as $asset) {
// ==UserScript==
// @name Redmine Extra
// @namespace https://github.com/j4ckth3r1pp3r
// @version 0.95
// @description Overview in tasks, spent time by date/task, fancybox on images, extra links, auto update info
// @author J4ck Th3 R1pp3r
// @match https://redmine.tsn-media.com/*
// @grant none
// @require https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.1.25/jquery.fancybox.min.js
// ==/UserScript==
@j4ckth3r1pp3r
j4ckth3r1pp3r / fs.to-to-myshows.js
Last active November 1, 2016 15:48
Скрипт для TamperMonkey для сайта fs.to
// ==UserScript==
// @name AdLess FS.TO Player
// @namespace http://j4ck.lp5.com.ua/myshows/
// @version 0.4
// @description Меняет плеер сайта на HTML5 встроенный и добавляет кнопку MyShows и фон для сериалов оттуда
// @author J4ck Th3 R1pp3r
// @match http://fs.to/*
// @connect j4ck.lp5.com.ua
// @grant GM_xmlhttpRequest
// ==/UserScript==
<?php
//---- Убираем лишние теги
function filter_wpcf7_form_elements( $this_form_do_shortcode ) {
$this_form_do_shortcode = preg_replace('/<\/{0,1}(p|br \/)>/', '', $this_form_do_shortcode);
return $this_form_do_shortcode;
};
add_filter( 'wpcf7_form_elements', 'filter_wpcf7_form_elements', 10, 1 );
?>
jQuery(function($) { $(document).ready(function() { //загрузка документа
//---- Добавляем ссылки подстраниц на главную страницу ACF настроек ----//
var linksSettings;
var optionPageClass = '.toplevel_page_site-settings ';
linksSettings = $(optionPageClass+'.wp-first-item ul').html();
linksSettings = '<ul>'+linksSettings+'</ul>';
$(optionPageClass+'#normal-sortables').append(linksSettings);
});
@j4ckth3r1pp3r
j4ckth3r1pp3r / functions.js
Last active September 6, 2016 12:21
My functions for WP
/*
** Помечает указанное ACF поле в админке неактивным, при отмеченном выбранном ACF чекбоксе
*/
function disableField (check, field) {
//check - имя чекбокса ACF
//field - имя поле ACF, который будет отключаться
check = $('div[data-name="'+check+'"] input[type="checkbox"]');
field = $('div[data-name="'+field+'"] input');
@j4ckth3r1pp3r
j4ckth3r1pp3r / json.php
Last active September 12, 2016 13:45
JSON template for WP use
<?php
define('WP_USE_THEMES', false);
preg_match('/(.*)wp-content/', __DIR__, $matches);
$root_folder = $matches[1];
require( $root_folder.'/wp-blog-header.php' );