This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<video src="video.ogv" id="myVideo"> | |
video not supported | |
</video> | |
<script type='text/javascript'> | |
document.getElementById('myVideo').addEventListener('ended',myHandler,false); | |
function myHandler(e) { | |
// What you want to do after the event | |
} | |
</script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).on("click", '.mylink', function(event) { | |
alert("new link clicked!"); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="discountcodefield"> | |
<label for="discount">Discount Code:</label> | |
<input autocomplete="off" type="hidden" name="discount" class="discount_code" /> | |
<input autocomplete="off" type="text" name="discount_code" class="discount_code_field" /> | |
<input type="button" name="apply_discount_code" class="btn discount_code_btn" value="Apply"/> | |
</div> | |
<div class="cart__savings discount_apply_code"> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="page-width" data-section-id="{{ section.id }}" data-section-type="cart-template"> | |
{% if cart.item_count > 0 %} | |
<div class="section-header text-center"> | |
<h1>{{ 'cart.general.title' | t }}</h1> | |
</div> | |
<form action="/cart" method="post" novalidate class="cart"> | |
{% if customer.tags contains 'wholesaler' %} | |
{% for custag in customer.tags %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @snippet Enable Payment Gateway for a Specific User Role | WooCommerce | |
*/ | |
function custom_paypal_enable_manager( $available_gateways ) { | |
global $woocommerce; | |
if ( isset( $available_gateways['paypal'] ) && !current_user_can('shop_manager') ) { | |
unset( $available_gateways['paypal'] ); | |
} | |
return $available_gateways; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//add additional columns to the users.php admin page | |
add_filter('manage_users_columns', 'project_add_user_id_column'); | |
function project_add_user_id_column($columns) { | |
$columns['church'] = 'Church name'; | |
// unset($columns['pmpro_membership_level']); //For remove a column | |
/*$columns = array( | |
"cb" => "", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Take from http://baylorrae.com/creating-a-cycle-function-in-php | |
function cycle($first_value, $values = '*') { | |
// keeps up with all counters | |
static $count = array(); | |
// get all arguments passed | |
$values = func_get_args(); | |
// set the default name to use | |
$name = 'default'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('a[href^="#"]').on('click', function(event) { | |
var target = $(this.getAttribute('href')); | |
if( target.length ) { | |
event.preventDefault(); | |
$('html, body').stop().animate({ | |
scrollTop: target.offset().top | |
}, 1000); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Goes in theme.liquid | |
{% if template contains 'contact' %} | |
{{ 'https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js' | script_tag }} | |
<script type="text/javascript"> | |
$(document).ready(function() { | |
var n1 = Math.round(Math.random() * 10 + 1); | |
var n2 = Math.round(Math.random() * 10 + 1); | |
$("#question").val(n1 + " + " + n2); | |
$(".contact-form").submit(function (e) { | |
if (eval($("#question").val()) != $("#answer").val()) { |
OlderNewer