Skip to content

Instantly share code, notes, and snippets.

View jameslaws's full-sized avatar

James Laws jameslaws

View GitHub Profile
@jameslaws
jameslaws / edd-slack-slash-command.php
Created December 16, 2014 19:05
Using Slack Slash Commands to get EDD sales info
<?php
function nftweak_slash_command() {
# Check to make sure this is a Slash Command Request
if ( ! isset( $_REQUEST['slack_slash'] ) && 'your_custom_string' != $_REQUEST['slack_slash'] )
return false;
# Check to see if a token has been passed as well
if ( ! isset( $_REQUEST['token'] ) )

Keybase proof

I hereby claim:

  • I am jameslaws on github.
  • I am jameslaws (https://keybase.io/jameslaws) on keybase.
  • I have a public key whose fingerprint is 45F0 92DC E74F FC3D 8DFC 15FD C3E1 4389 33C4 D522

To claim this, I am signing this object:

@jameslaws
jameslaws / ninja-forms-field-groups.php
Created December 11, 2013 15:04
Group Fields in Ninja Forms This code allows you to group fields by adding the nf-open-field-group to the first field in a group and nf-close-field-group to the last field in a group. Fields must already be in proper order.
<?php
function nfjal_open_field_group( $field_id, $data ) {
if ( !$class = $data['class'] ) {
$class = '';
}
if ( strstr( $class, 'nf-open-field-group' ) ) {
$class = nfjal_get_group_wrap_class( $class );
echo '<div class="' . $class . '">';
}
@jameslaws
jameslaws / nf-add-anchor.php
Last active December 29, 2015 08:39
Create an anchor on forms so when a form is submitted without AJAX it return to the form.
<?php
function nfjal_add_anchor_to_form() {
echo '<div name="ninja-form-top"></div>';
}
add_action( 'ninja_forms_display_before_form_wrap', 'nfjal_add_anchor_to_form' );
function nfjal_add_anchor_to_url() {
global $ninja_forms_processing;
$url = 'http://YOUR_URL/#ninja-forms-top';
$ninja_forms_processing->update_form_setting( 'landing_page', $url );