Skip to content

Instantly share code, notes, and snippets.

View cubehrends's full-sized avatar
🏠
Working from home

Christian Behrends cubehrends

🏠
Working from home
View GitHub Profile
@cubehrends
cubehrends / functions.php
Last active November 6, 2017 08:34
WooCommerce Exclude Free Shipping
<?php
function free_shipping_based_on_cart_shipping_class( $is_available ) {
$cart_items = WC()->cart->get_cart();
foreach ( $cart_items as $cart_item ) {
$product = $cart_item['data'];
$class = $product->get_shipping_class();
<li class="custom-social-icon icon-xing2">
<a href="https://www.xing.com/profile/Firstname_Lastname" class="icon">
<span><?php esc_html_e( 'x', 'Divi' ); ?></span>
</a>
</li>
/* XING Social Icon Classes
--------------------------------------------------------------- */
#top-header .custom-social-icon a {
font-size: 14px;
line-height: 1em;
}
.custom-social-icon a {
display: inline-block;
position: relative;
color: #666;
/* XING for Divi Font-Face Import
--------------------------------------------------------------- */
@font-face {
font-family: 'xing';
src: url('fonts/xing.eot?2a5kpv');
src: url('fonts/xing.eot?2a5kpv#iefix') format('embedded-opentype'),
url('fonts/xing.ttf?2a5kpv') format('truetype'),
url('fonts/xing.woff?2a5kpv') format('woff'),
url('fonts/xing.svg?2a5kpv#icomoon') format('svg');
font-weight: normal;
<?php
function event_pre_get_posts( $query ) {
// modify queries for 'event' post type only
if( isset( $query->query_vars['post_type'] ) && $query->query_vars['post_type'] == 'event' ) {
$query->set('orderby', 'meta_value');
$query->set('meta_key', 'eventdetails_eventday_1');
$query->set('order', 'ASC');
<script>
(function( $ ) {
$( "#js-caller" ).on( "click", function( event ){
alert('Payload executed!');
event.preventDefault();
});
})( jQuery );
</script>
(function($) {
var $select = $('#wc_checkout_add_ons_1');
$select.change(function () {
if ( $(this).val() == 'none' ) {
hideFields();
} else {
showFields();
<?php
function toggle_checkout_add_ons_enqueue() {
if( is_page( 'checkout' ) ) {
wp_enqueue_script( 'mytheme-tcao-js', get_stylesheet_directory_uri() . '/js/toggle_checkout_add_ons.js', array('jquery'), '1.0', true);
}
}
add_action( 'wp_enqueue_scripts', 'toggle_checkout_add_ons_enqueue' );
<script>
(function( $ ) {
$( '.et_pb_toggle' ).hover(function() {
$( this ).children( 'h5' ).trigger( 'click' );
});
})( jQuery );
</script>
<?php
function wdt_dashboard_widget_content() {
echo '<h3>Images</h3>
<ul>
<li>Featured 1080×608px</li>
<li>Person 600×600px</li>
<li>Sponsor Logo 400×200px</li>
</ul>';
echo '<h3>Colors</h3>
<ul>