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
add_action('init', 'cg_init'); | |
function cg_init() { | |
add_action('woocommerce_cart_calculate_fees', 'cg_add_fee'); | |
add_action('wp_footer', 'cg_footer', 9999); | |
} | |
function cg_footer() { | |
?> | |
<script type="text/javascript"> |
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 | |
/* | |
Plugin Name: eventON single custom field | |
Plugin URI: https://eventon.com | |
Description: A text field for eventON submit event form | |
Author: Basilis Kanonidis | |
Version: 2.0 | |
License: GPLv2 or later | |
*/ |
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
function mk_convert_rgba($colour, $alpha) | |
{ | |
if (!empty($colour)) { | |
if ($alpha >= 0.95) { | |
return $colour; // If alpha is equal 1 no need to convert to RGBA, so we are ok with it. :) | |
} else { | |
if ($colour[0] == '#') { | |
$colour = substr($colour, 1); | |
} | |
if (strlen($colour) == 6) { |
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
// Avg downloads per customer | |
function sc_edd_avg_downloads_per_customer( $atts ) { | |
$amount = 0; | |
$query = new WP_Query( array( 'post_type' => 'download' ) ); | |
foreach( $query->posts as $post ) { | |
$amount = $amount + edd_get_download_sales_stats( $post->ID ); | |
} | |
$amount = $amount / edd_count_total_customers(); | |
return number_format( $amount, 2 ); | |
} |
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
<form class="mk-searchform" method="get" id="searchform" action="<?php echo home_url(); ?>"> | |
<input type="text" class="text-input" value="<?php if(!empty($_GET['s'])) echo get_search_query(); ?>" name="s" id="s" /> | |
<input type="hidden" value="59" name="cat" id="scat" /> | |
<i class="mk-icon-search"><input value="" type="submit" class="search-button" type="submit" /></i> | |
</form> |
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_action( 'edd_complete_purchase', 'fes_add_buyers_as_vendors', 10, 1 ); | |
function fes_add_buyers_as_vendors( $payment_id ){ | |
$customer_id = edd_get_payment_customer_id( $payment_id ); | |
$db_user = new FES_DB_Vendors(); | |
if ( $db_user->exists( 'id', $customer_id ) { | |
return; | |
} |
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
/* Smartphones (portrait and landscape) ----------- */ | |
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) { | |
/* Styles */ | |
} | |
/* Smartphones (landscape) ----------- */ | |
@media only screen and (min-width : 321px) { | |
/* Styles */ | |
} |
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
function add_is_mobile_bodyclass($classes) { | |
//adds a class of "wp_is_mobile" to the body class of the page | |
if (wp_is_mobile()) { | |
$classes[] = 'wp_is_mobile'; | |
} | |
return $classes; | |
} | |
add_filter('body_class','add_is_mobile_bodyclass'); |
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
function custom_wp_is_mobile() { | |
static $is_mobile; | |
if ( isset($is_mobile) ) | |
return $is_mobile; | |
if ( empty($_SERVER['HTTP_USER_AGENT']) ) { | |
$is_mobile = false; | |
} elseif ( | |
strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false |
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
function logedout_singular_redirect() { | |
if (!is_user_logged_in() && ( is_singular( 'job_listing' ) ) | |
) { | |
// feel free to customize the following line to suit your needs | |
wp_redirect(site_url('my-page-slug/')); | |
exit; | |
} | |
} | |
add_action('template_redirect', 'logedout_singular_redirect'); |