Skip to content

Instantly share code, notes, and snippets.

@max-kk
max-kk / edd_generate_new_coupon.php
Last active April 15, 2017 09:59
Easy Digital Downloads - generate new coupon via PHP
<?php
// http://edd.wp-a2z.org/oik_api/edd_store_discount/
// https://gist.github.com/renventura/9a645b904279862614a4
function create_coupon_edd3466( $args ) {
if( ! is_callable( 'edd_store_discount' ) ) {
return;
}
@max-kk
max-kk / shortde_for_last_contest.php
Last active October 22, 2017 10:55
FV - shortde for last contest
<?php
add_shortcode('last_fv', function(){
$contest = ModelContest::query()
->limit(1)
->sort_by('date_finish', 'DESC')
->findRow();
if (!$contest) {
@max-kk
max-kk / Disable click on Thumbnail.js
Created November 3, 2017 13:45
FV - Disable click on Thumbnail
jQuery(function($){
jQuery(document).on('click', '.fv_lightbox', function(e){
e.preventDefault();
return false;
});
});
@max-kk
max-kk / video1
Last active December 10, 2017 09:33
Video example for lanings
<div style="text-align: center">
<video style="margin-left: 50px;" width="853" height="480" poster="video/maxresdefault.jpg?2" controls="">
<source src="video/amst_video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</div>
<script>
$('.video > video').click(function(){
if (this.paused) {
@max-kk
max-kk / tribe_events_custom_filter_field.php
Last active March 22, 2018 13:46
How to add custom filter field to Tribe Events Calendar without Filter addon (in this example - filter by category and tag). Example: https://monosnap.com/file/kD9Liz759zrsxi6lnSL49KHxAu8haX
<?php
// Example: https://monosnap.com/file/kD9Liz759zrsxi6lnSL49KHxAu8haX
// Tested with Tribe Events Calendar 4.6.12
/**
* Set up the keyword search in the tribe events bar.
*
* @param array $filters The current filters in the bar array.
*
@max-kk
max-kk / default-transaltions.php
Last active April 7, 2018 14:57
u2guide polylang transaltion table
<?php
/**
* return default messages for frontend translated with i18n
*
* @return array $key => $title
*/
function fv_get_default_public_translation_messages()
{
@max-kk
max-kk / test.html
Created April 11, 2018 17:18
pumperlgsund test
<!DOCTYPE html>
<html lang="de-DE" prefix="og: http://ogp.me/ns#">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width"/>
<link rel="stylesheet" type="text/css"
href="https://www.pumperlgsund.info/wp-content/themes/pg-contest/Resources/Public/pumperlgsund-bio.de/css/styles.css"/>
@max-kk
max-kk / video_as_post.php
Last active May 15, 2018 09:20
WP Foto Vote - Trigger when Youtube Video is uploaded and Video thumbnail parsed by Video addon
<?php
## Trigger when Youtube Video is uploaded and Video thumbnail parsed by Video addon
add_action("wp_youtube_upload_attachment_thumbnail_saved", function($att){
// Update competitor Thumbnail& change type to Video
$competitor = ModelCompetitors::q()->where('image_id', $att->get_post_id() )->findRow();
if ( !$competitor ) {
@max-kk
max-kk / wc_walltet.php
Last active May 24, 2018 14:53
WC Wallet and WP Foto Vote
<?php
define("POINTS_PER_UPLOAD", 20);
/**
* Change money for upload
*/
add_action('fv/public/upload_after_insert', function($competitor_ID) {
$competitor = new FV_Competitor( $competitor_ID, false );
@max-kk
max-kk / add_this_to_child_theme_functions.php
Created June 5, 2018 13:48
Google Analytics Dashboard for WP (GADWP) :: How to exclude specific pages from displaying traking code
<?php
// COPY CODE AFTER THIS LINE >>>>>
/**
* Exclude specific pages from displaying traking code
* Created: 05 June 2018
* Tested With Wordpress 4.9.6 and GADWP 5.3.3
* You need to specify page ID's for exclude
* How to find page/post ID: https://www.competethemes.com/blog/find-page-id/