Skip to content

Instantly share code, notes, and snippets.

View rianrietveld's full-sized avatar

Rian Rietveld rianrietveld

View GitHub Profile
@rianrietveld
rianrietveld / linked-logo.html
Last active November 25, 2020 10:46
Linked logo with SCG
<div class="header__logo">
<a href="home-url">
<span class="screen-reader-text">Logo [company name], links to the homepage</span>
<svg class="header__logo--svg" width="80px" height="80px"
viewBox="0 0 80 80" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
role="presentation"
focusable="false">
[g's...]
</svg>
</a>
@rianrietveld
rianrietveld / old-and-new.html
Created October 23, 2020 09:06
Number of filters
<!-- old -->
<button class="ol-button ol-button--primary ol-button--js-filter" aria-expanded="false">
<span class="ol-button--amount" aria-hidden="true" style="display: inline;">
4
</span>
<span class="ol-button__text">
Meer filters
</span>
<span class="ol-button__icon">
<i class="ol-icon ol-icon-plus" aria-hidden="true"></i>
@rianrietveld
rianrietveld / search-label.html
Created July 10, 2018 13:43
FacetWP Search input field misses corresponding label
Current code:
<div class="facetwp-facet facetwp-facet-xxx_search_training_type facetwp-type-search" data-name="xxx_search_training_type" data-type="search">
<span class="facetwp-search-wrap">
<i class="facetwp-btn"></i>
<input type="text" class="facetwp-search" value="" placeholder="Placehoder text here">
</span>
</div>
Suggested code:
<div class="facetwp-facet facetwp-facet-xxx_search_training_type facetwp-type-search" data-name="xxx_search_training_type" data-type="search">
<?php
// disable yoast seo nag messages
// via https://wordpress.org/support/topic/turn-off-yoast-seo-has-been-updated-to-version-message
if ( class_exists( 'Yoast_Notification_Center' ) ) {
remove_action( 'admin_notices', array( Yoast_Notification_Center::get(), 'display_notifications' ) );
remove_action( 'all_admin_notices', array( Yoast_Notification_Center::get(), 'display_notifications' ) );
}
?>
@rianrietveld
rianrietveld / functions.php
Last active August 29, 2015 14:25
Add Accessibility theme support to Genesis
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Add Accessibility support
add_theme_support( 'genesis-accessibility', array( 'headings', 'drop-down-menu', 'search-form', 'skip-links', 'rems' ) );
@rianrietveld
rianrietveld / remove-items-admin-bar.php
Created June 14, 2015 07:58
Remove items from the WordPress admin bar
<?php
add_action( 'admin_bar_menu', 'prefix_remove_stuf_admin_bar', 999 );
function prefix_remove_stuf_admin_bar( $wp_admin_bar ) {
$wp_admin_bar->remove_node( 'wp-logo' );
$wp_admin_bar->remove_node( 'comments' );
$wp_admin_bar->remove_node( 'wpseo-menu' );
if ( !current_user_can( 'edit_others_pages' ) ) {
@rianrietveld
rianrietveld / cpt-template.php
Last active August 29, 2015 14:23
Assign a template to a single custom post type page
<?php
// set custom post type templates in post meta
add_action('publish_name_cpt', 'prefix_add_template', 10, 2 );
function prefix_add_template( $post_id, $post ) {
if ( $post_id == 1234 ) {
add_post_meta( $post_id, '_wp_page_template', 'your-template.php', true );
}
@rianrietveld
rianrietveld / english.php
Last active August 29, 2015 14:23
Template file language switcher on entry-content only (Genesis)
<?php
/**
* Template Name: English page
* Adds lang=en to the entry-content div only
*
* @package Genesis\Templates
* @author Rian Rietveld
* @license GPL-2.0+
*/
@rianrietveld
rianrietveld / responsive-menu.js
Created April 22, 2015 15:16
Accessible Genesis responsive-menu.js
jQuery(function( $ ){
$("header .genesis-nav-menu, .nav-primary .genesis-nav-menu").addClass("responsive-menu").before('<h2 class="screen-reader-text" id="rian-main-nav">Main navigation</h2><button class="responsive-menu-icon" aria-expanded="false">Menu</button>');
$(".responsive-menu-icon").click(function(){
var _this = $( this );
_this.attr( 'aria-expanded', _this.attr( 'aria-expanded' ) === 'false' ? 'true' : 'false' );
$(this).next("header .genesis-nav-menu, .nav-primary .genesis-nav-menu").slideToggle();
});
@rianrietveld
rianrietveld / responsive-menu-old.js
Created April 22, 2015 15:15
Inaccessible Genesis responsive-menu.js
jQuery(function( $ ){
$("header .genesis-nav-menu, .nav-primary .genesis-nav-menu").addClass("responsive-menu").before('<div class="responsive-menu-icon"></div>');
$(".responsive-menu-icon").click(function(){
$(this).next("header .genesis-nav-menu, .nav-primary .genesis-nav-menu").slideToggle();
});
$(window).resize(function(){
if(window.innerWidth > 768) {