Skip to content

Instantly share code, notes, and snippets.

@davevanhoorn
davevanhoorn / functions.php
Created August 3, 2018 05:10
Remove "Products" from Yoast SEO breadcrumbs in WooCommerce
/*
** Paste in functions.php
** Remove "Products" from Yoast SEO breadcrumbs in WooCommerce
*/
add_filter( 'wpseo_breadcrumb_links', function( $links ) {
// Check if we're on a WooCommerce page
// Checks if key 'ptarchive' is set
// Checks if 'product' is the value of the key 'ptarchive', in position 1 in the links array
if ( is_woocommerce() && isset( $links[1]['ptarchive'] ) && 'product' === $links[1]['ptarchive'] ) {
@verticalgrain
verticalgrain / wordpress-json-cheatsheet.md
Last active November 23, 2023 10:00
Wordpress JSON API Cheat Sheet

POSTS:

Get a post by id:

http://mixmeals.com/wp-json/wp/v2/posts/?filter[p]=12

Get multiple posts by id:

http://mixmeals.com/wp-json/wp/v2/posts/?include=470,469

@vladimirsiljkovic
vladimirsiljkovic / select.css
Last active November 26, 2022 09:59
Cross-browser (IE11+) <select> element styling without wrapper <div> https://jsbin.com/diqene/edit?html,css,output
select {
-webkit-appearance: none; /* Webkit */
-moz-appearance: none; /* FF */
-ms-appearance: none; /* Edge */
appearance: none; /* Future */
/* Optional styles */
padding: 0.3em 1.5em 0.3em 0.6em;
border: 1px solid currentColor;
background: white;
@EvanHerman
EvanHerman / check-if-element-in-viewport-on-scroll.js
Last active September 23, 2024 08:13
Check when an element comes into view (jQuery)
function isOnScreen(elem) {
// if the element doesn't exist, abort
if( elem.length == 0 ) {
return;
}
var $window = jQuery(window)
var viewport_top = $window.scrollTop()
var viewport_height = $window.height()
var viewport_bottom = viewport_top + viewport_height
var $elem = jQuery(elem)