Skip to content

Instantly share code, notes, and snippets.

View lazy-related-posts.php
@philhoyt
philhoyt / fields-submit.html
Created December 16, 2016 00:19
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 December 16, 2016 02:01
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
Last active September 9, 2022 10:30
Using Advanced Custom Fields to create your Post Title
View advanced-custom-fields-post-title.php
<?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 );
wp_update_post(
array(
@philhoyt
philhoyt / enqueue-google-fonts-wordpress.php
Last active July 2, 2018 23:54
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