Skip to content

Instantly share code, notes, and snippets.

View alenb's full-sized avatar

Alen Birindzic alenb

View GitHub Profile
@alenb
alenb / abc.json
Created February 17, 2018 12:10 — forked from tonyganch/abc.json
Alphabetical sort order for csscomb.js (based on csscomb.json)
{
"sort-order": [
"-webkit-animation",
"-moz-animation",
"-ms-animation",
"-o-animation",
"animation",
"-webkit-animation-delay",
"-moz-animation-delay",
"-ms-animation-delay",
@alenb
alenb / Mark parent navigation active when on custom post type single page 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
add_action('nav_menu_css_class', 'add_current_nav_class', 10, 2 );
function add_current_nav_class($classes, $item) {
// Getting the current post details
global $post;
// Getting the post type of the current post