Skip to content

Instantly share code, notes, and snippets.

View RiFi2k's full-sized avatar

Reilly Lowery RiFi2k

View GitHub Profile
<?php update_post_meta( $post_id, $meta_key, $meta_value, $prev_value ); ?>
//add attendee to event ateendee list (relationship)
$event_id = $_POST['post_id'];
$attendee_list = get_field( 'attendees_list', $event_id );
$new_attendee = get_post( $attendee_id );
if( !is_array($attendee_list) ):
$attendee_list = array();
endif;
// Make everything static
class My_Plugin
{
private static $var = 'foo';
static function foo()
{
return self::$var; // never echo or print in a shortcode!
}
// This filter is executed during form load. When set to true, the form init scripts are loaded
// in the footer of the site, instead of the default location of which is in the page
// body immediately after the form.
add_filter( 'gform_init_scripts_footer', '__return_true' );
// This example dynamically adds a custom class to all text fields
add_filter( 'gform_field_css_class', 'custom_class', 10, 3 );
function custom_class( $classes, $field, $form ) {
if ( $field->type == 'text' ) {
$classes .= ' custom_textfield_class';
<?php
class GFFormDisplay{
public static $submission = array();
private static $init_scripts = array();
const ON_PAGE_RENDER = 1;
const ON_CONDITIONAL_LOGIC = 2;
public static function process_form($form_id){
<noscript>
<style type="text/css">
.pagecontainer {display:none;}
</style>
<div class="noscriptmsg">
You don't have javascript enabled. Good luck with that.
</div>
</noscript>
//add_action( 'save_post_tribe_events', 'usasf_save_events', 10, 3 );
function usasf_save_events( $post_id, $post, $update ) {
// verify if this is an auto save routine.
// If it is our form has not been submitted, so we dont want to do anything
if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
return;
// Check permissions
if ( 'page' == $post->post_type ) {
// Add the hook action
add_action('transition_post_status', 'send_new_post', 10, 3);
// Listen for publishing of a new post
function send_new_post($new_status, $old_status, $post) {
if('publish' === $new_status && 'publish' !== $old_status && $post->post_type === 'post') {
// Do something!
}
}
//add_action( 'template_redirect', 'usasf_check_forsale' );
function usasf_check_forsale() {
if ( is_singular( 'tribe_events' ) ) {
$post_object = get_queried_object();
$post_id = get_queried_object_id();
$regional = get_field( 'is_regional_event', $post_id );
if ( ! $regional ) {
return;
add_action( 'admin_menu', 'add_my_admin_menus' );
/**
* Create the administration menus in the left-hand nav and load the JavaScript conditionally only on that page
*/
function add_my_admin_menus(){
$my_page = add_menu_page( 'Page Title', 'Menu Title', MY_ADMIN_CAPABILITY, 'menu-slug', 'show_page_content' );
// Load the JS conditionally
add_action( 'load-' . $my_page, 'load_admin_js' );
*filter
# Base policy
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
# Don't attempt to firewall internal traffic on the loopback device.
-A INPUT -i lo -j ACCEPT