Posts relating to
Dev Tricks
Convert br tags to span tags
July 6th, 2019Have you ever needed to convert the string immediately before br tags and wrap it in span tags instead? Me too. There is very likely a regex solution but here’s a very simple way to achieve it using string and array functions. /** * Replace linebreaks with span tags * * Wraps each string immediately before a […]
Cross-browser support for hiding scrollbars, including FireFox
May 13th, 2019Cross-browser support for scrollbar styling and visibility is a challenge. It’s as simple as that. This article provides a solution that addresses the issue of hiding the scrollbars, using scrollbar-width, ::-webkit-scrollbar and -ms-overflow-style. What are Scrollbars? Scrollbars are bars that appear down the right-hand side and across the bottom of the browser (or an element […]
Website Performance Gets Little Wins Using ‘noopener’
May 2nd, 2019Your website performance is critical for great user experience and can certainly help with SEO, too. One little know performance drain
Compress directories from the command line, excluding node_modules and development files
February 13th, 2019This simple article provides a CLI command to compress a directory whilst excluding specific sub-directories and files. We do a lot of custom development using modern development tools. From time-to-time we need to compress certain directories for deployment to production. In such cases, it is very common that some files and sub-directories need to be […]
How to fix the issue with IntelliJ and PHPStorm not resolving SASS and JS Imports
December 17th, 2018This article describes how to resolve the issue with IntelliJ not providing autocomplete for imported SASS and JS resources. The same fix can be applied to PHPStorm. IntelliJ is an awesome IDE, but recently it stopped recognising imported SASS and JS resources. This didn’t stop them from compiling, but was very annoying, as it flagged […]
Remove menu link types from the WordPress menu options screen
November 13th, 2018On a client site, we wanted to restrict menu items to Custom Links, only. Thus remove all other menu types. The main drive behind this was to improve the user experience and reduce confusion, as the menu is only for Social Links. With a brief search yielding very little I set about coding a solution, […]
How to break long words using CSS @supports
November 7th, 2018Recently, I had an odd scenario where wrapping long text needed either word-wrap, overflow-wrap or word-break to achieve the same overflow pattern across different browsers. To arrive at a suitable solution I opted to use @supports to maintain control of the declarations. What is @supports? @supports is a feature query, whose associated block of statments […]
Conditionally enqueue scripts and stylesheets on specific pages
November 3rd, 2018There are many use-cases where scripts and stylesheets only need to be loaded on certain pages. One such example would be to only load the JavaScript and CSS stylesheets for Contact Form 7 (a lightweight contact form plugin) on the contact page. This article will demonstrate how to conditionally load the JS and CSS for […]
Nesting CSS Media Queries
October 28th, 2018Processing styling rules based on certain criteria, such as viewport width, is achieved using the @media conditional group rules. As of October 2018, all modern browsers support nested @media queries. What’s a @media query? Here’s a simple example of a media query to make the text 10% bigger on devices with a screen (viewport) wider than 768px […]
Adding Feature Images to the WordPress RSS Feed
October 26th, 2018The WordPress RSS feed is great. We use it with third-party services, such as MailChimp. One key datum that isn’t included in the feeds by default is the featured image for posts (and pages). This article will address that with a simple ‘action‘ hook that adds the featured image to the item’s feed. /** * […]