Skip to content

Instantly share code, notes, and snippets.

Avatar

Phil Hoyt philhoyt

View GitHub Profile
@philhoyt
philhoyt / fields-submit.html
Created Dec 16, 2016
Custom Ninja Forms Submit Button
View fields-submit.html
<script id="tmpl-nf-field-submit" type="text/template">
<a id="nf-field-{{{ data.id }}}" class="btn {{{ data.renderClasses() }}} nf-element " target="_self" href="#">
<span class="btn-content">{{{ data.label }}}</span>
<span class="icon"><i class="fa fa-arrow-right" aria-hidden="true"></i></span>
</a>
</script>
@philhoyt
philhoyt / ninja_forms_field_template_file_paths.php
Last active Dec 16, 2016
Ninja Form Custom Field Template Path
View ninja_forms_field_template_file_paths.php
add_filter( 'ninja_forms_field_template_file_paths', 'custom_field_file_path' );
function custom_field_file_path( $paths ){
$paths[] = get_stylesheet_directory() . '/ninja-forms/templates/';
return $paths;
}
View simple-custom-meta-box.php
/**
* Adds a meta box
*/
function simple_meta_box() {
add_meta_box( 'prfx_meta', ( 'View Post' ), 'simple_meta_box_callback', 'staff', 'side', 'high' );
}
add_action( 'add_meta_boxes', 'simple_meta_box' );
/**
* Outputs the content of the meta box
@philhoyt
philhoyt / advanced-custom-fields-post-title.php
Created Dec 13, 2016
Using Advanced Custom Fields to create your Post Title
View advanced-custom-fields-post-title.php
// Create Title and Slug
function acf_title( $value, $post_id, $field ) {
if ( get_post_type( $post_id ) == 'staff' ) {
$new_title = get_field('first_name', $post_id) . ' ' . $value;
$new_slug = sanitize_title( $new_title );
// update post
wp_update_post( array(
'ID' => $post_id,
@philhoyt
philhoyt / enqueue-google-fonts-wordpress.php
Last active Jul 2, 2018
Enqueue Google Fonts in WordPress
View enqueue-google-fonts-wordpress.php
/**
* Register custom fonts.
*/
function themeslug_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/*
* Translators: If there are characters in your language that are not supported
You can’t perform that action at this time.