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 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; |
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
// Make everything static | |
class My_Plugin | |
{ | |
private static $var = 'foo'; | |
static function foo() | |
{ | |
return self::$var; // never echo or print in a shortcode! | |
} |
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
// 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'; |
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 | |
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){ |
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
<noscript> | |
<style type="text/css"> | |
.pagecontainer {display:none;} | |
</style> | |
<div class="noscriptmsg"> | |
You don't have javascript enabled. Good luck with that. | |
</div> | |
</noscript> |
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( '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 ) { | |
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 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! | |
} | |
} |
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( '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; |
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
*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 |