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 defined('ABSPATH') or header('Location: /'); | |
/** | |
* Cleanup WP admin and unwanted code... | |
*/ | |
// Remove actions | |
remove_action('welcome_panel', 'wp_welcome_panel'); | |
remove_action('dashboard_primary', 'wp_dashboard_primary'); | |
remove_action('admin_color_scheme_picker', 'admin_color_scheme_picker'); |
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
//For example we need to modify all <img> tags in the templates that use ACF img fields. | |
//To locate them in the theme we need to know their names. | |
//This snippet will list the names of all ACF fields of image type used on the site, so that we'll be able to search for them in the theme files | |
$field_groups = acf_get_field_groups(); | |
$all_fields = array(); | |
foreach ($field_groups as $field_group){ | |
$fields = acf_get_fields($field_group['key']); | |
$all_fields = array_merge($all_fields, $fields); | |
} |
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 | |
/** | |
* By default, cURL sends the "Expect" header all the time which severely impacts | |
* performance. Instead, we'll send it if the body is larger than 1 mb like | |
* Guzzle does. | |
*/ | |
function add_expect_header(array $arguments) | |
{ | |
$arguments['headers']['expect'] = ''; |
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
// get all field groups that have location User Add/Edit Form | |
$field_groups = acf_get_field_groups(array( 'user_form' => 'edit')); | |
$all_fields = array(); | |
foreach ($field_groups as $field_group){ | |
$fields = acf_get_fields($field_group['key']); | |
$all_fields = array_merge($all_fields, $fields); //get all user's fields together | |
} | |
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
add_shortcode( 'acf_registration', 'acf_registration' ); | |
function acf_registration() { | |
$args = array(); //arguments here | |
ob_start(); | |
acf_form( $args ); | |
$registration_form = ob_get_contents(); | |
ob_end_clean(); | |
return $registration_form; | |
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 | |
/** | |
* Delete the option setting for the default category | |
* | |
* @link https://cameronjonesweb.com.au/blog/how-to-remove-the-uncategorised-category-from-wordpress-and-woocommerce | |
*/ | |
function cameronjonesweb_delete_default_category_option() { | |
if ( get_option( 'default_category' ) ) { | |
delete_option( 'default_category' ); | |
} |
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 | |
function cameronjonesweb_colour_scheme() { | |
return array( | |
array( | |
'name' => 'White', | |
'slug' => 'white', | |
'color' => '#ffffff', | |
), | |
array( |
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/register_block_type_args', 'cameronjonesweb_automatically_enqueue_block_stylesheet' ); | |
function cameronjonesweb_automatically_enqueue_block_stylesheet( $args ) { | |
if ( empty( $args['enqueue_style'] ) ) { | |
$file = get_template_directory_uri() . '/blocks/' . ltrim( $args['name'], 'acf/' ) . '/block.css'; | |
if ( file_exists( str_replace( get_template_directory_uri(), get_template_directory(), $file ) ) ) { | |
$args['enqueue_style'] = $file; | |
} | |
} |
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 rewrite rule. | |
* | |
* @since 1.0.0 | |
* | |
* @param array $rules Existing rewrite rules | |
* @return array | |
*/ | |
if( ! function_exists( 'prefix_add_rewrite_rules' ) ) { |
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 | |
/** | |
* WP_Dev_Rewrites initial setup | |
* | |
* @since 1.0.0 | |
*/ | |
if( !class_exists('WP_Dev_Rewrites') ) { | |
class WP_Dev_Rewrites { |
NewerOlder