Code Comments Hierarchy

Category: Code Snippets

/* #################################################### L E V E L – O N E #################################################### */ /* :::::::::::::::::::::::::::::::::::::::::::::::::::: Level – Two */ /* Level three */ <!– #################################################### L E V E L – O N E #################################################### –> <!– :::::::::::::::::::::::::::::::::::::::::::::::::::: Level – Two –> <!– Level three –> /* #################################################### L E V E L – O… Read more »

Continue Reading

Get URL parameter string – jQuery

Category: Code Snippets

var getUrlParameter = function getUrlParameter(sParam) { var sPageURL = decodeURIComponent(window.location.search.substring(1)), sURLVariables = sPageURL.split(‘&’), sParameterName, i; for (i = 0; i < sURLVariables.length; i++) { sParameterName = sURLVariables[i].split(‘=’); if (sParameterName[0] === sParam) { return sParameterName[1] === undefined ? true : sParameterName[1]; } } }; And this is how you can use this function assuming the URL… Read more »

Continue Reading

Add class to body based on the URL – jQuery

Category: Code Snippets

// find the pathname var urlPath = window.location.pathname; //convert to lowercase urlPath.match(/\/(.*?)(\+|$)/)[1].toLowerCase(); // remove the first character urlPath = urlPath.replace(/\//g, ‘-‘).slice(1); //remove file extension urlPath = urlPath.replace(/\.[^/.]+$/, “”); // add class to body $(document.body).addClass(urlPath); // If body has no class its propably the homepage $(‘body:not([class])’).addClass(‘home’);  

Continue Reading

Yoast Breadcrumbs CSS Styles for WordPress Templates

Category: Code Snippets

The Yoast SEO plugin is great and offers a nice breadcrumbs snippet. Unfortunately, there is not an easy way to add a wrapper ID or class to the breadcrumbs for styling. Follow the steps below to change that.

Continue Reading