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 | |
// Init | |
// ----------------------------------------------------------------------- | |
define('DOING_AJAX', true); | |
define('SHORTINIT', true); | |
// WP Load | |
// ----------------------------------------------------------------------- | |
require('wp-load.php'); |
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/pre_load_reference', 'hwk_bypass_get_field_ref', 10, 3); | |
function hwk_bypass_get_field_ref($return, $field_name, $post_id){ | |
if(is_int($post_id)) | |
$return = acf_get_field($field_name, $post_id); | |
return $return; | |
} |
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 | |
/** | |
* ACF Form: Deregister ACF style | |
*/ | |
add_action('wp_print_styles', 'hwk_acf_form_deregister_styles', 99); | |
function hwk_acf_form_deregister_styles(){ | |
wp_deregister_style('acf'); | |
wp_deregister_style('acf-field-group'); | |
wp_deregister_style('acf-global'); |
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
/** | |
* ACF Form: Prevent default form submit | |
*/ | |
jQuery(document).on('submit', '.acf-form', function(e) { | |
e.preventDefault(); | |
}); | |
/** | |
* ACF Form: Init | |
*/ |
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('acf/render_field_group_settings', 'hwk_acf_field_groups_add_settings', 10); | |
function hwk_acf_field_groups_add_settings($group){ | |
/**************** | |
* Basic | |
****************/ | |
// Text | |
// Return: "hwk_text": "foo bar" | |
acf_render_field_wrap(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('request', 'hwk_post_type_toplevel_request', 1, 1); | |
function hwk_post_type_toplevel_request($query){ | |
$post_type = 'portfolio'; | |
if(isset($query[$post_type]) && isset($query['post_type']) && $query['post_type'] === 'portfolio') | |
return $query; |
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('sanitize_file_name', 'hwk_sanitize_file_name'); | |
function hwk_sanitize_file_name($input){ | |
$path = pathinfo($input); | |
$extension = (isset($path['extension']) && !empty($path['extension'])) ? $path['extension'] : ''; | |
$file = (!empty($extension)) ? preg_replace('/.' . $extension . '$/', '', $input) : $input; | |
return sanitize_title(str_replace('_', '-', $file)) . ((!empty($extension)) ? '.' . $extension : ''); | |
} |
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 | |
// Register Post Type | |
add_action('init', 'hwk_post_type_exemple', 0); | |
function hwk_post_type_exemple(){ | |
register_post_type('exemple', array( | |
'hierarchical' => false, // true | false. See 'post_row_actions' & 'page_row_actions' filters | |
'public' => false, | |
'show_ui' => true, | |
'show_in_menu' => true, |
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_false'); | |
// Post Type Subpages: Settings | |
function hwk_ptsp_settings(){ | |
$settings = array( | |
array( | |
// Le Post Type cible. |
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
/* | |
* Gutenberg: Fix metaboxes | |
*/ | |
.edit-post-layout__metaboxes:not(:empty) .edit-post-meta-boxes-area{ | |
margin:10px 10px 0; | |
} | |
.edit-post-layout__metaboxes:not(:empty) { | |
background:#f3f4f5; | |
} |
NewerOlder