Skip to content

Instantly share code, notes, and snippets.

@bkno
bkno / snippet.php
Last active November 13, 2023 20:29
Gravity Forms User Reg Add-on Prepopulate
<?php
add_filter(
'gform_user_registration_user_data_pre_populate',
function( $mapped_fields, $form, $feed ) {
// Select field - this works
$mapped_fields[5] = 'input_value';
// Checkboxes field - does not work
@bkno
bkno / wp2static_v7_wpml.php
Last active May 10, 2022 13:07 — forked from stevygee/wp2static_v7_wpml.php
Add WPML translations to WP2Static v7
<?php
/**
* ------------------------------
* | WP2Static WPML Integration |
* ------------------------------
*
* Important: The option WPML > Languages > "Adjust IDs for multilingual functionality" must be disabled.
*/
function wp2static_wpml_get_translated_posts_urls() {
function exclude_category($query) {
if ( $query->is_feed ) {
$query->set('cat', '-999'); // replace 999 with your category ID
}
return $query;
}
add_filter('pre_get_posts', 'exclude_category');
@bkno
bkno / functions.php
Created February 20, 2018 13:01
Divi child theme functions.php
/*
Create /css and /js subdirectories in child theme directory.
Create /css/site.css for front-end styles.
Create /js/site.js for front-end scripts.
Create /css/admin.css for back-end styles.
Create /js/admin.js for back-end scripts.
*/
$version = time(); // changes on every page load; set to something like '2018-01-01' in production
[--] Skipped version check for MySQLTuner script
[OK] Currently running supported MySQL version 5.1.61-log
[OK] Operating on 64-bit architecture
-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MRG_MYISAM
[--] Data in InnoDB tables: 631M (Tables: 36)
[!!] Total fragmented tables: 36
[!!] failed to execute: SHOW TABLE STATUS FROM \`#mysql50#.history\`
[!!] FAIL Execute SQL / return code: 256
@bkno
bkno / Debug eloquent queries in Laravel 5.php
Created February 19, 2016 12:00
Debug eloquent queries in Laravel 5
<?php
use DB;
DB::enableQueryLog();
// execute queries here
dd(DB::getQueryLog());