Skip to content

Instantly share code, notes, and snippets.

View amberhinds's full-sized avatar

Amber Hinds amberhinds

View GitHub Profile
@amberhinds
amberhinds / candidate-import.php
Created October 4, 2018 20:11
This is an example of a file that creates new posts in a custom post type from the Eventbrite Attendee API
<?php
function candidate_import($continuation, $event_id, $event_name, $token){
$log;
$log .= 'Event: '.$event_name.'<br />';
//check if API call should be paginated and if so get the continuation key
if(empty($continuation)){
//first page call
@amberhinds
amberhinds / functions.php
Created April 12, 2024 14:47
Remove posts in category from blog archive
/** Remove shorts category from the blog **/
add_filter( 'pre_get_posts', 'amber_exclude_shorts_category' );
function amber_exclude_shorts_category ( $query ) {
if ( $query->is_home && ! is_admin() ) {
$query->set( 'cat', '-272' );
}
return $query;
}
@amberhinds
amberhinds / functions.php
Created April 11, 2024 17:53
How to remove all rules of type from Accessibility Checker
function my_rule_type_filter($rules){
$rules = edac_remove_element_with_value($rules, 'rule_type', 'warning'); // Removes all warnings
return $rules;
}
add_filter('edac_filter_register_rules','my_rule_type_filter');
@amberhinds
amberhinds / functions.php
Created April 11, 2024 17:49
How to remove a specific rule from Accessibility Checker Scans
function my_rule_filter($rules){
$rules = edac_remove_element_with_value($rules, 'slug', 'slider_present'); // Replace the slug with the slug of the rule you want to remove.
return $rules;
}
add_filter('edac_filter_register_rules','my_rule_filter');
@amberhinds
amberhinds / functions.php
Last active April 9, 2024 15:09
edac_max_alt_length Accessibility Checker filter example
function change_max_alt_length( $max ) {
return 100; // Shorten alt text max character count to 100 from default (300).
}
add_filter( 'edac_max_alt_length', 'change_max_alt_length' );
@amberhinds
amberhinds / functions.php
Created August 14, 2023 19:07
Add row and col scope to table headers in TablePress
/**
* Add scope attributes to table headers
*
* @param mixed $output HTML output of the table.
* @param mixed $table Table object.
* @param array $render_options Render options.
* @return string HTML output of the table.
*/
function tablepress_add_scope( $output, $table, $render_options ) {
$dom = new DOMDocument();
@amberhinds
amberhinds / style.css
Created January 15, 2024 20:55
CSS Fixes to make WooCommerce more accessible
/** Fix focus indicators **/
.editor-styles-wrapper .wc-block-grid__products .wc-block-grid__product .wc-block-components-product-image a:focus,
.wc-block-components-product-image a:focus,
.wp-element-button:focus,
.wp-block-button__link:focus {
outline-style: solid;
outline-width: 2px;
outline-offset: 2px;
}
@amberhinds
amberhinds / table.html
Last active March 21, 2023 04:15
HTML Table with row and column scoped headers
<table>
<thead>
<tr>
<th scope="col">Video Creation & Editing Features</th>
<th scope="col">Free</th>
<th scope="col">Pro</th>
<th scope="col">Team</th>
<th scope="col">Enterprise</th>
</tr>
</thead>
@amberhinds
amberhinds / Footer.php
Created February 14, 2023 04:14
Strip role="button" from Elementor links
@amberhinds
amberhinds / likert-bad.html
Last active November 11, 2021 23:12
This shows the current (incorrect) HTML in the likert field
<div id="field_2_3" class="gfield gfield_contains_required field_sublabel_below field_description_above gfield_visibility_visible gsurvey-survey-field " data-field-class="gsurvey-survey-field">
<label class="gfield_label">Were you satisfied with the overall TA or support you received?
<span class="gfield_required">
<span class="gfield_required gfield_required_asterisk"> * <span class="sr-only"> Required</span>
</span></span>
</label>
<div class="ginput_container ginput_container_likert">
<table class="gsurvey-likert" id="input_2_3">
<thead>
<tr>