Skip to content

Instantly share code, notes, and snippets.

/**
* Limit User to One Submission Per Time Period
* http://gravitywiz.com/2012/04/25/limit-user-to-one-submission-per-time-period/
*/
// update the "5" to your form ID
add_action('gform_pre_render_5', 'gform_limit_submissions');
function gform_limit_submissions($form){
global $wpdb;
@Wp1stop
Wp1stop / gist:3437c71746f9d21dd959
Created August 22, 2014 01:25
Custom form to Gravity Form Web API
<?php
/*
Template Name: Gravity Form
*/
get_header() ; ?>
<link type="text/css" rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/easy-responsive-tabs.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/style.css">
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/responsive.css" media="screen" >
@Wp1stop
Wp1stop / gist:bedd74750063c5ea9b7d
Last active August 29, 2015 14:05
Colorbox Wordpress Ajax login onpage load if loggedout
<link rel="stylesheet" href="<?php bloginfo(template_url); ?>/css/colorbox.css" />
<script src="<?php bloginfo(template_url); ?>/jquery.colorbox-min.js"></script>
<?php
/**
* Page Template
*
* This template is the default page template. It is used to display content when someone is viewing a
* singular view of a page ('page' post_type) unless another page template overrules this one.
* @link http://codex.wordpress.org/Pages
@Wp1stop
Wp1stop / limit24
Created August 28, 2014 00:17
Allow only 1 post every 24hrs Wordpress - only the display area
<?php //echo wpufe_can_post();
global $user_ID;
$recent = get_posts(array(
'author'=>$user_ID,
'orderby'=>'date',
'order'=>'desc',
'numberposts'=>1
));
if( $recent ){
@Wp1stop
Wp1stop / gist:f0da6fafc445dbeeebed
Created August 29, 2014 15:55
Form limit Gravity form - Wp user front end various scripts
// update the "5" to your form ID
//add_action('gform_pre_render_1', 'gform_limit_submissions');
function gform_limit_submissions($form){
global $wpdb;
$limit_message = 'You may only submit this form once every 24 hours.';
$limit_time = 86400; // must be specified in seconds; 86400 seconds is equal to 24 hours
@Wp1stop
Wp1stop / gist:7aa37e7f71affd9923d6
Created September 3, 2014 17:26
Replace Curly Quote with simple quote
itemDescription.replace(/[\u2018\u2019]/g, "'");
@Wp1stop
Wp1stop / gist:58dcb6f988370ff10ee7
Created September 3, 2014 17:30
Woocommerce get Cart and Transfer to IGlobalStores
<?php
$thecart = json_encode($woocommerce->cart->get_cart());
$thecart = str_replace("'", "", json_encode($woocommerce->cart->get_cart(), JSON_HEX_APOS));
//$result = preg_replace("/[^a-zA-Z0-9]+/", "", $woocommerce->cart->get_cart());
@Wp1stop
Wp1stop / gist:f7e1cbf86a6494b1eca2
Created September 4, 2014 19:55
Simple jQuery script to set up a floating header to a set height.
jQuery(window).scroll(function () {
var scrollTop = jQuery(window).scrollTop();
//elementOffset = $('#my-element').offset().top,
// distance = (elementOffset - scrollTop);
console.log(scrollTop);
if(scrollTop > 120 ) { console.log('stop div');
jQuery('#masthead').css('position','fixed');
@Wp1stop
Wp1stop / gist:09361ffe2816b33fb62c
Created September 4, 2014 21:10
The events Calendar current pageid issue on Calendar page - find one page your on
if(tribe_is_month()) {
echo 'Calendar Grid';
} else if(tribe_is_event() && !tribe_is_day() && !is_single()) {
echo 'Event List';
} else if(tribe_is_event() && !tribe_is_day() && is_single()) {
echo 'Single Event';
} else if(tribe_is_day()) {
echo 'Single Day';
} else {
the_title();