This file contains 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 | |
namespace PhilKurth; | |
use WP_Error; | |
/** | |
* Class adds a simple math equation to the registration form in order to help combat SPAM submissions. | |
*/ | |
class SimpleWooRegistrationSpamFilter { |
This file contains 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_action( 'admin_post_acf_sync', function () { | |
$field_groups = acf_get_field_groups(); | |
// Apply our callback to all field groups | |
array_map( function ( $field_group ) { | |
// Load up the fields on the field group. |
This file contains 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 this in your wp-config.php file | |
define('ACF_PRO_LICENSE', '{YOUR LICENSE KEY HERE}' ); | |
This file contains 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 | |
// The field accepts a value with this structure | |
$value = [ | |
'address' => '123 Example St, Townsville XYZ 1234, Country', | |
'lat' => - 38.1486228, | |
'lng' => 144.360414, | |
'zoom' => 14, | |
'place_id' => 'Ei0xMjMgTW9vcmFib29sIFN0LCBHZWVsb25nIFZJQyAzMjIwLCBBdXN0cmFsaWEiMBIuChQKEgmX0JaIHBTUahFyH_LC9sYD8hB7KhQKEglDz-DYDxTUahECZY8QisCjzg', | |
'street_number' => 123, |
This file contains 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_action( 'rest_api_init', function () { | |
register_rest_route( 'my-namespace/v1', 'some/route', [ | |
'methods' => [ 'GET' ], | |
'permission_callback' => '__return_true', | |
'callback' => function () { | |
// You can return arrays or objects here — WordPress will | |
// format them for output as JSON. |
This file contains 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 | |
advanced_form( 'form_61806dc10891f', [ | |
'exclude_fields' => [ | |
'field_61806e15ca267', | |
'email', | |
] | |
] ); | |
This file contains 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 | |
// A simple example of using filemtime() to version enqueued assets with their | |
// last modified time. | |
add_action( 'wp_enqueue_scripts', function () { | |
wp_register_style( | |
'styles', | |
get_stylesheet_directory_uri() . '/style.css', | |
[], |
This file contains 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 will replace the 'wp-json' REST API prefix with 'api'. | |
// Be sure to flush your rewrite rules for this change to work. | |
add_filter( 'rest_url_prefix', function () { | |
return 'api'; | |
} ); | |
This file contains 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 | |
// In a post/page template, loop over the ACF flexible field layouts and load the partial | |
// responsible for rendering the layout. | |
while ( the_flexible_field('my_flexi_field') ) { | |
get_template_part( 'components/'. get_row_layout() ); | |
} |
This file contains 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('acf/settings/remove_wp_meta_box', '__return_true'); |