Skip to content

Instantly share code, notes, and snippets.

@SteveJonesDev
SteveJonesDev / script.js
Created March 30, 2023 15:06
Advanced Custom Fields Block Javascript
(function($){
/**
* initializeBlock
*
* Adds custom JavaScript to the block HTML.
*
* @date 10/11/21
* @since 1.0.0
*
@SteveJonesDev
SteveJonesDev / accessible-menu.php
Last active January 22, 2025 04:42
Accessible WordPress Navigation Menu
<div class="menu-container">
<button class="menu-button" aria-expanded="false" aria-controls="site-header-menu" aria-label="<?php esc_attr_e( 'Menu', 'textdomain' ); ?>"></button>
<div id="site-header-menu" class="site-header-menu">
<?php
wp_nav_menu(
array(
'theme_location' => 'primary',
'container' => 'nav',
'container_class' => 'main-navigation',
'container_id' => 'site-navigation',
@SteveJonesDev
SteveJonesDev / script.js
Created October 20, 2022 04:03
FacetWP submit search field with enter key
$(document).keypress(function(event){
var keycode = (event.keyCode ? event.keyCode : event.which);
if(keycode == '13'){
if($('.facetwp-search').is(":focus")){
FWP.refresh();
}
}
});
@SteveJonesDev
SteveJonesDev / functions.php
Created March 2, 2021 19:14
Accessibility Checker Filter Readability Score Content
add_filter('edac_filter_readability_content', 'edadc_custom_readability_content', 1, 2);
function edadc_custom_readability_content($content, $post_id){
$content .= get_field('my_custom_field',$post_id);
return $content;
}
@SteveJonesDev
SteveJonesDev / functions.php
Created July 19, 2019 15:54
Add custom avatar size to Genesis user profile widget
// add custom avatar size to Genesis user profile widget
add_filter( 'genesis_gravatar_sizes', 'sjd_user_profile' );
function sjd_user_profile( $sizes ) {
$sizes['Extra Large Image'] = 200;
return $sizes;
}
@SteveJonesDev
SteveJonesDev / functions.php
Created July 9, 2019 20:25
Change featured image size on a specific archive page in Genesis
// Change featured image size on a specific archive page
function sjd_custom_loop_image_size( $image_size ) {
if(is_archive('testimonial')){
$image_size = 'content-slider';
return $image_size;
}
}
add_filter( 'genesis_pre_get_option_image_size', 'sjd_custom_loop_image_size' );
@SteveJonesDev
SteveJonesDev / functions.php
Created July 9, 2019 17:43
Add Custom Color Palette to ACF Pro Color Picker Field
function sjd_acf_input_admin_footer() {
?>
<script type="text/javascript">
(function($) {
acf.add_filter('color_picker_args', function( args, $field ){
// add the hexadecimal codes here for the colors you want to appear as swatches
args.palettes = ['#ffffff','#000000']
@SteveJonesDev
SteveJonesDev / functions.php
Last active June 5, 2019 14:39
Wordpress - Change Enter Title Here Text
add_filter('enter_title_here', 'my_title_place_holder' , 20 , 2 );
function my_title_place_holder($title , $post){
if( $post->post_type == 'pet' ){
$my_title = "Animal Name";
return $my_title;
}
return $title;
}
@SteveJonesDev
SteveJonesDev / functions.php
Created October 16, 2018 14:13
WordPress Admin Branding Include
/*
Admin Branding
*/
$admin_branding_url = get_stylesheet_directory() . '/includes/admin-branding.php';
if(file_exists($admin_branding_url)) {
include_once($admin_branding_url);
}
@SteveJonesDev
SteveJonesDev / functions.php
Created May 10, 2018 18:30
Add class to links generated by next_posts_link and previous_posts_link
add_filter('next_posts_link_attributes', 'posts_link_attributes');
add_filter('previous_posts_link_attributes', 'posts_link_attributes');
function posts_link_attributes() {
return 'class="button"';
}