Skip to content

Instantly share code, notes, and snippets.

View gicolek's full-sized avatar

Rafał Gicgier - Certified Codeable Expert Developer gicolek

View GitHub Profile
@gicolek
gicolek / wp-mediaelement.js
Last active August 29, 2015 14:00
MJ Handler
/* global mejs, _wpmejsSettings */
(function($) {
// add mime-type aliases to MediaElement plugin support
mejs.plugins.silverlight[0].types.push('video/x-ms-wmv');
mejs.plugins.silverlight[0].types.push('audio/x-ms-wma');
$(function() {
var currentID,
settings = {
success: function(media, node, player) {
@gicolek
gicolek / mj.php
Created April 22, 2014 11:58
Media Element js hook
add_action( 'init', 'rg_deregister' );
function rg_deregister() {
wp_deregister_script( 'mediaelement' );
wp_register_script( 'mediaelement', get_template_directory_uri() . '/_ui/js/mediaelement-and-player.min.js', array( 'jquery' ) );
wp_register_script( 'mediaelement-featuredection', get_template_directory_uri() . '/_ui/js/me-featuredetection.js', array( 'mediaelement' ) );
wp_enqueue_script( 'mediaelement-featuredection' );
@gicolek
gicolek / sample.html
Created April 15, 2014 14:26
gf sample
<form method="post" enctype="multipart/form-data" id="gform_1" action="/beantown/wp/contact-us/">
<div class="gform_body">
<ul id="gform_fields_1" class="gform_fields left_label description_below"><li id="field_1_11" class="gfield gsection"><h2 class="gsection_title">We'd love to hear from you!</h2><div class="gsection_description"><div class="vcard"><span class="fn">Erica Voigt</span>
<span>Proprietor</span><a class="email" href="mailto:[email protected]">[email protected]</a>
<a class="tel" href="tel:+16179369047">617.936.9047</a>
</div></div></li><li id="field_1_12" class="gfield"><label class="gfield_label" for="input_1_12">First name</label><div class="ginput_container"><input name="input_12" id="input_1_12" type="text" value="" class="medium" tabindex="1"></div></li><li id="field_1_13" class="gfield"><label class="gfield_label" for="input_1_13">Last name</label><div class="ginput_container"><input name="input_13" id="input_1_13" ty
@gicolek
gicolek / full.php
Created March 4, 2014 14:59
Full Code
<?php
add_filter( 'gform_field_input', 'gf_field_input', 10, 5 );
wp_enqueue_script( 'jquery-ui-datepicker' );
/**
* Overwrite gravity forms input field
*
* @hook gform_field_input
<?php
add_action( 'gform_pre_submission_1', 'gf_form_pre_submission' );
/**
* Presubmission form handler
*
* @hook gform_pre_submission
*/
function gf_form_pre_submission($form) {
@gicolek
gicolek / gf_inlinejs.php
Created March 4, 2014 14:57
WordPress Head Inline js
<?php
add_action( 'wp_head', 'gf_trigger_picker' );
/**
* Inject js code into the head, used with ACF
* @hook wp_head
*/
function gf_trigger_picker() {
@gicolek
gicolek / gf_input.php
Last active November 12, 2021 06:37
Gravity Forms overwrite the input
<?php
add_filter( 'gform_field_input', 'gf_field_input', 10, 5 );
function gf_field_input($input, $field, $value, $lead_id, $form_id) {
// we don't want to change the admin look behavior of the form field
if ( IS_ADMIN )
return $input;
// lets create custom form html in case it had the css class assigned
@gicolek
gicolek / shit.css
Created November 27, 2013 17:39
shit.css
* {
color: blue;
}
@gicolek
gicolek / add-to-cart.php
Created November 23, 2013 21:33
Woo Commerce loop add to cart
<?php
/**
* Loop Add to Cart
*
* @author WooThemes
* @package WooCommerce/Templates
* @version 1.6.4
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@gicolek
gicolek / prefix-woo-ajax.js
Created November 23, 2013 21:03
JavaScript handler for custom WooCommerce ajax cart data.
$('body').on('adding_to_cart', function(event, param1, param2) {
// pick the data from somewhere and define extra product_data parameter
// event and param1 parameteres serve no need in that case
param2.logo_text = 'My great logo!';
});