Skip to content

Instantly share code, notes, and snippets.

View anderskristo's full-sized avatar
👶
Focusing

Anders Kristoffersson anderskristo

👶
Focusing
View GitHub Profile
@EloB
EloB / gist:a0ee602489939b63dc41
Created June 14, 2015 18:36
Toggle path hints magento bookmarklet
javascript:var key,pattern,search%3Bif(!localStorage.easyTemplatePathKey)%7Bkey%3Dprompt(%27Easy template path hints code%27,%27magento%27)%3Bif(key!%3D%3Dnull)%7BlocalStorage.easyTemplatePathKey%3Dkey%3B%7D%7Dkey%3DlocalStorage.easyTemplatePathKey%3Bif(key!%3D%3Dnull)%7Bpattern%3Dnew RegExp(%27%26%3Ftp%3D1%26code%3D%27%2Bkey)%3Bsearch%3D(location.search.indexOf(%27%3F%27)%3D%3D%3D0%3F%27%27:%27%3F%27)%2B(pattern.test(location.search)%3Flocation.search.replace(pattern,%27%27):((location.search.length>1%3F%27%26%27:%27%27)%2B%27tp%3D1%26code%3D%27%2Bkey))%3Bsearch%3Dsearch.length>1%3Fsearch:%27%27%3Blocation.href%3Dlocation.protocol%2B%27//%27%2Blocation.host%2Blocation.pathname%2Bsearch%2Blocation.hash%3B%7D
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active May 7, 2024 01:27
A badass list of frontend development resources I collected over time.
@gerbenvandijk
gerbenvandijk / Mark parent navigation active when on custom post type single page
Last active January 1, 2024 21:22
Mark (highlight) custom post type parent as active item in Wordpress Navigation.When you visit a custom post type's single page, the parent menu item (the post type archive) isn't marked as active. This code solves it by comparing the slug of the current post type with the navigation items, and adds a class accordingly.
<?php
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Get post ID, if nothing found set to NULL
$id = ( isset( $post->ID ) ? get_the_ID() : NULL );