dustin caruso

dustin caruso

Front-End / JavaScript / UI / WordPress / Shopify Developer

loading FontAwesome locally if the CDN fails

Just this week I had a problem w/ two of my clients’ websites. It seems that Font Awesome wasn’t loading from the CDN that they supply after you fill out the form on their “Get Started” page (pictured above). The solution I slapped together (below) will only work if your site is using this JavaScript loader (1st line of code below, but your’s won’t have all zeros).

It basically looks for a value that would be in an object returned with the FontAwesome code. If that value doesn’t exist, then it will use the CSS file specified in the “document.write…” line of code (replace this with the location and name of your local FontAwesome file).

<script src="https://use.fontawesome.com/0000000000.js"></script>

<script>
	if (!window.FontAwesomeCdnConfig.useUrl) {
		document.write('<script src="/my-site/css/font-awesome.min.css"><\/script>');
	}
</script>

Please, let me know in the comments if this little tip helped you at all.

Facebook Open Graph meta tags in WordPress

How to get your page or post content in the description tag

Getting the Open Graph meta tags (that Facebook parses when sharing a webpage) to be populated with the proper content can sometimes be tricky when working with HTML code that is dynamically generated by WordPress.

Below is the quickest and simplest way I’ve come up with to do this. As always, I like to share my discoveries in hopes that it saves other people the time I had to spend Googling and testing my solutions.

In the “header.php” file of your theme, add the following code, just above your Open Graph meta tags…

<?php $d = strip_tags(get_post($post->ID)->post_content); ?>

* the “d” variable stands for description. 😉
* the “strip_tags” bit ensures your description doesn’t include HTML tags.

Then output the description in your meta tag like so…

<meta property="og:decription" content="<?php echo $d; ?>">

Please, let me know in the comments if this little tip helped you at all.

TIPS FOR BETTER CHARACTER SKETCHING

Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.

Continue reading

DESIGNING FOR A BEAUTIFUL WEB

Responsive web design offers us a way forward, finally allowing us to design for the ebb and flow of things. There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly.
Nullam at ligula ac metus molestie hendrerit et id odio. Integer fringilla imperdiet arcu nec scelerisque. Quisque mollis, lorem sit amet porttitor convallis, sem lectus tincidunt libero, quis tincidunt justo leo et purus. Nulla vitae ullamcorper magna. Fusce quis ultrices magna, ultricies auctor nibh. Mauris massa orci, pretium nec imperdiet eget, ornare et quam. Sed fermentum rutrum pharetra. Quisque gravida congue eros, et mollis magna sagittis in. Sed condimentum pretium enim, sit amet facilisis magna luctus ut. Etiam consectetur nulla pulvinar varius varius. Phasellus tristique, massa sed semper interdum, velit lorem suscipit massa, ut pellentesque turpis lectus ut magna. Ut semper pulvinar neque, nec congue tellus egestas sit amet. Phasellus arcu purus, placerat et faucibus sed, pretium quis nunc. Sed tempus in tortor ac pulvinar. Phasellus tristique id diam eget vehicula.
Sed imperdiet facilisis mi, vitae posuere erat interdum in. Praesent sagittis aliquet nulla, iaculis pharetra risus rhoncus eget. Nulla et est id tortor ullamcorper luctus ut in mauris. Vestibulum vitae blandit neque. Pellentesque enim risus, sollicitudin et cursus sed, vehicula non sapien. Aliquam nec velit a risus semper porttitor eget ac nisi. Sed a commodo enim, ac aliquam mi. Vestibulum sodales convallis lacus, a viverra elit accumsan ac. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed laoreet massa et mi euismod, a vehicula lectus interdum. Pellentesque lorem nibh, commodo eget venenatis in, placerat sit amet orci. Aliquam id eleifend mi, eget dictum lorem.