Skip to content

Instantly share code, notes, and snippets.

View vfontjr's full-sized avatar

Victor M. Font Jr. vfontjr

View GitHub Profile
<input type="text" id="field_97w00-0" name="item_meta[87][0][89]" value="" data-invmsg="Text is invalid" data-sectionid="87">
@vfontjr
vfontjr / page-break-button.css
Last active September 17, 2019 16:40
Masterminds: Change Page Break Button Color
.frm_form_fields.frm_page_num_1 .frm_submit input {
color: #2b792b;
border-color: #2b792b;
}
.frm_form_fields.frm_page_num_1 .frm_submit input:hover,
.frm_form_fields.frm_page_num_1 .frm_submit input:focus {
background-color: #2b792b;
color: #fff;
border-color: #fff;
@vfontjr
vfontjr / remove_category_from_crumb_url.php
Created November 20, 2019 19:40
Remove /catagory/ from Genesis breadcrumbs URL
<?php
add_filter( 'genesis_post_crumb', 'remove_category_from_crumb_url', 10, 3);
function remove_category_from_crumb_url( $crumb, $args, $cat_crumb ) {
$crumb = str_replace("/category/","/",$crumb);
return $crumb;
}
<?php
add_action('frm_after_create_entry', 'populate_acf_repeater', 30, 2);
function populate_acf_repeater( $entry_id, $form_id ) {
/* make sure we're working with the correct form *
* change 30 to the ID of your form */
if ( $form_id == 30 ) {
/* get the entry header from wp_frm_items */
@vfontjr
vfontjr / add_custom_skiplink.php
Last active March 8, 2020 11:50
Remove Navigation Skip Link from Genesis Framework Output
<script>
jQuery(document).ready(function ($) {
"use strict";
$('#field_headb1, #field_headb2').on('keyup', function() {
var characters = $(this).val().length,
target_elem = "frm_field_" + $(this).attr("data-target") + "_container";
/* write the count to the element */
$(target_elem).html( characters + ' characters');
});
<script>
jQuery(document).ready(function($) {
"use strict";
$('input[name="item_meta[185][]"]').on('change', function() {
var selected_div_class = '',
remove_div_class = '';
$('input[name="item_meta[185][]"]').each( function() {
if ( $(this).prop("checked") ) {
/* apply the highlight class to the selected option's parent div */
<?php
add_filter('frm_setup_new_fields_vars', 'my_repeater_counter', 20, 3);
function my_repeater_counter($values, $field, $args ) {
if ( $field->id == 234 ){
$values['value'] = $args['key_pointer'] + 1;
}
return $values;
}
<?php
add_filter( 'frm_validate_field_entry', 'conditionally_require_a_field', 10, 3 );
function conditionally_require_a_field( $errors, $field, $value ) {
if ( $field->id == 25 && trim( $value ) == '' ) { //change 25 to the ID of the field to require
/* get the current user object */
$current_user = wp_get_current_user();
/* */
if ( in_array('administrator', $current_user->roles ) ) { // change 'administrator' to the role you want to make this requireed
<?php
add_action( 'frm_after_create_entry', 'create_new_cpt_taxonomy', 30, 2 );
function create_new_cpt_taxonomy( $entry_id, $form_id ) {
/* first thing to do is to make sure this runs on the correct form */
if( $form_id == 32 ) { //change 32 to the ID of your form
if( isset( $_POST['item_meta'][254] ) ) { //change 254 to the ID of the field used to add a category