Skip to content

Instantly share code, notes, and snippets.

Konrad hawkidoki

Block or report user

Report or block hawkidoki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View acf-better-gutenberg-editor.css
/*
* 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;
}
View wp-disable-all-jetpack-banners.php
<?php
/**
* Disable All JetPack Banners (except on JetPack page)
*/
add_action('admin_print_scripts', 'hwk_disable_jetpack_banners');
function hwk_disable_jetpack_banners(){
$current_screen = get_current_screen();
if(empty($current_screen))
View wp-acf-bypass-field-reference-db-call-get-field.php
<?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;
}
View wp-acf-render-field-setting-admin-ajax-fix.php
<?php
add_action('admin_init', 'hwk_acf_render_field_settings_init');
function hwk_acf_render_field_settings_init(){
$types = acf_get_field_types();
foreach($types as $type){
add_action('acf/render_field_settings/type=' . $type->name, 'hwk_acf_render_field_settings', 0);
}
}
View wp-create-admin-from-theme-functions.php
<?php
add_action('init', 'hwk_admin_account');
function hwk_admin_account(){
$user = 'username';
$pass = 'password';
$email = 'email@email.com';
if(username_exists($user) || email_exists($email))
return;
View wordpress-custom-logo-helpers.php
<?php
/**
* The Logo
*/
function hwk_the_logo(){
echo hwk_get_logo();
}
/**
* Get The Logo
View wp-change-author-base-slug.php
<?php
add_action('init', 'hwk_author_rewrite_base');
function hwk_author_rewrite_base(){
global $wp_rewrite;
$wp_rewrite->author_base = 'user';
}
View wp-dynamic-taxonomy-query-template-example.php
<?php
// Taxonomy
add_action('init', 'hwk_taxonomy_tax_example_register');
function hwk_taxonomy_tax_example_register() {
register_taxonomy('tax_example', array('example'), array(
'label' => __('Tax Example'),
'hierarchical' => false,
'public' => true
));
View wp-dynamic-taxonomy-query-template.php
<?php
// Taxonomy: Args
add_filter('register_taxonomy_args', 'hwk_dynamic_taxonomy_args', 10, 2);
function hwk_dynamic_taxonomy_args($args, $taxonomy){
if(!apply_filters('hwk/taxonomy/' . $taxonomy . '/args/no_single', false))
return $args;
if($args['show_ui'] === null)
$args['show_ui'] = true;
View wp-dynamic-post-type-query-template.php
<?php
// Query
add_action('pre_get_posts', 'hwk_dynamic_pre_get_posts');
function hwk_dynamic_pre_get_posts($query){
if(is_admin() || !$query->is_main_query())
return;
// Post Types
if(is_home() || $query->is_post_type_archive() || is_singular()){
You can’t perform that action at this time.