This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { dispatch } from '@wordpress/data'; | |
const saveCustomData = (data) => { | |
return ( { select, dispatch } ) => { | |
const store = dispatch('my-plugin/store'); | |
store.setSaving(true); | |
fetch('/wp-json/my-plugin/v1/save', { | |
method: 'POST', | |
body: JSON.stringify(data), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'wp_die_handler', 'my_custom_wp_die_handler' ); | |
function my_custom_wp_die_handler( $handler ) { | |
return 'my_override_wp_die'; | |
} | |
function my_override_wp_die( $message, $title = '', $args = array() ) { | |
if ( trim( $message ) === 'Oops! This file is protected.' ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function getLastFridayOfMonth($year, $month) { | |
// Start with the last day of the month | |
$lastDay = new DateTime("$year-$month-01"); | |
$lastDay->modify('last day of this month'); | |
// Find the last Friday before or on the last day of the month | |
if ($lastDay->format('N') < 5) { | |
// If the last day is before Friday, subtract days to reach the last Friday | |
$lastDay->modify('last Friday'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function add_or_update_entry_meta( $entry_id, $field_key, $value ){ | |
/* convert field_key to field_id for software portability */ | |
$field_id = FrmField::get_id_by_key($field_key); | |
/* check for existing value */ | |
$field_val_exists = FrmProEntriesController::get_field_value_shortcode(array('field_id' => $field_id, 'entry' => $entry_id)); | |
/* add or update as appropriate */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function create_init_field_vars_array( $form_key ) { | |
global $wpdb; | |
/* initialize the variables for the formidable tables */ | |
$wpdb_prefix = $wpdb->prefix; | |
$frm_fields = $wpdb_prefix . 'frm_fields'; | |
$form_id = FrmForm::get_id_by_key( $form_key ); | |
$new_key = str_replace('-', '_', $form_key); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
This function was created by ChatGPT and does the following: | |
1. Checks if the input file exists. | |
2. Opens the input CSV file for reading. | |
3. Ensures the output directory exists, creating it if necessary. | |
4. Reads the header row of the CSV. | |
5. Loops through each row of the input CSV file. | |
6. Creates a new output file every 400 rows, including the header row. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
/* install this script in the after fields section on the | |
* form's CustomizeHTML page. | |
*/ | |
jQuery(document).ready(function($) { | |
"use strict"; | |
/** | |
* original code found on StackExchange | |
* addmonths: function used to calculate renewal date | |
* date {dateStr} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* masterminds_update_user_roles function. | |
* | |
* This is the main callback function for the | |
* frm_after_create_entry and frm_after_update_entry actions | |
* It's purpose is to process Developers Directory registrations | |
* and grant various WordPress roles based on user responses | |
* | |
* @access public |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.frm-star-group .star-rating { | |
margin-right: .25rem !important; | |
} | |
.frm-star-group input + label::before, .frm-star-group .star-rating::before { | |
font-family: 'Font Awesome 6 Pro' !important; | |
content: '' !important; | |
color: var(--mastermind-primary-color) !important; | |
} | |
.frm-star-group:not(.frm-star-hovered) input[type="radio"]:checked + label::before, .frm-star-group input + label:hover::before, .frm-star-group:hover input + label:hover::before, .frm-star-group .star-rating-on::before, .frm-star-group .star-rating-hover::before { | |
font-weight: 900 !important; |
NewerOlder