Skip to content

Instantly share code, notes, and snippets.

View jameslaws's full-sized avatar

James Laws jameslaws

View GitHub Profile

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 / 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'] ) )
@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 );
@jameslaws
jameslaws / nf-field-markup.html
Last active October 4, 2016 22:05
Ninja Forms Example Field Markup
<div class="nf-field-container {field-type-name}-container label-above">
<div class="nf-before-field">
<nf-section></nf-section>
</div>
<div class="nf-field">
<div id="nf-field-{field_id}-wrap" class="field-wrap {field-type-name}-wrap" data-field-id="{field_id}">
<div class="nf-field-label">
<label for="nf-field-{field_id}" class="">Single Line Text</label>
</div>
<div class="nf-field-element">
@jameslaws
jameslaws / nf-css-field-container.css
Created October 5, 2016 18:35
Styling the Field Container of a Ninja Form
/*
Styling all field containers
*/
.nf-field-container {
/* Your CSS styles */
}
/*
Styling a field type container
EXAMPLE: .textbox-container {}
*/
@jameslaws
jameslaws / nf-css-field-wrap.css
Created October 5, 2016 18:42
Styling the Field Wrap of a Ninja Form
/*
Styling all field wraps
*/
.field-wrap {
/* Your CSS styles */
}
/*
Styling a field type wrap
EXAMPLE: .textbox-wrap {}
*/
@jameslaws
jameslaws / nf-css-field-label.css
Created October 5, 2016 18:50
Styling the Field Label of a Ninja Form
/*
Styling all field labels
*/
.field-wrap label {
/* Your CSS styles */
}
/*
Styling a field type labels
EXAMPLE: .textbox-wrap label {}
@jameslaws
jameslaws / nf-hide-asterisk.css
Created October 10, 2016 18:48
How do I hide the asterisk on required fields
.ninja-forms-req-symbol {
display: none;
}
@jameslaws
jameslaws / hide-all-fields-required-mesage.css
Last active November 11, 2016 01:43
How do I hide the "All fields marked with an * are required" message
.nf-form-fields-required {
display: none;
}
@jameslaws
jameslaws / ninja-forms-remove-add-new.php
Created October 28, 2015 02:46
Remove the Ninja Forms Add New Form button from wp_editor if non-admin
<?php
function example_remove_add_new( $instance ) {
if ( ! current_user_can( 'manage_options' ) ) {
remove_filter( 'media_buttons_context', array( $instance->add_form_button, 'insert_form_tinymce_buttons' ) );
}
}
add_action( 'nf_admin_init', 'example_remove_add_new' );