Make WordPress Theme Headers Shrink on Scroll

WordPress Code Snippet

Modern web design favors a top-fixed masthead that shrinks when a page is scrolled downwards. The masthead, also known as the header, is the top of the page that contains the brand logo and navigation bar. Makes sense to keep the header visible at all times and make the header shrink while the page is … Read more

Make a Timestamp Shortcode

Epoch Time Shortcode Plugin for WordPress

This snippet creates a shortcode to display the Unix Epoch time. Most likely reason you might use this plugin is to create DoubleClick cache busting links. I wrote a WordPress plugin for this same purpose. The plugin contains the same code snippet. It is up to you whether you add this snippet to functions.php or … Read more

Alexa Graph and Badge Shortcodes for WordPress

Alexa Internet Screenshot Courtesy of Wikepedia

Alexa is a web analytics company of the Amazon brand. The website statistics published by Alexa are extrapolations from data gathered from browsing habits and other sources. These stats can be used to compare and evaluate websites or – more frequently – to show off a website’s global and local rank. The official widget scripts for … Read more

Adding Features to WordPress via functions.php

PHP code snippet

Many features that can be added to WordPress with a few lines of code are not worth wrapping into a plugin. Instead of writing a plugin for short snippets, we tend to paste the code snippets into a theme file called functions.php. JournalXtra’s new QuickSnips category is the place to be to grab simple WordPress … Read more

Add Scripts to WP Header.php with Functions.php

Sometimes we need to add references to scripts, metatags or conditional styles to the WordPress <head></head> section in header.php. WordPress has an action hook for this purpose. It’s very easy to use. To add scripts, conditional styles or links to header.php, use the wp_head() action hook, like this: add_action(‘wp_head’, ‘function_name’); function function_name() { echo “\n”; … Read more