WooCommerce Product Category and Terms Select Filters [code snippet]

Category: Code Snippets

The code below will help you add a form select filter for Woocommerce online shop on WordPress. <?php $categories = get_terms( [‘taxonomy’ => ‘product_cat’, ‘hide_empty’ => true] ); ?> <div class=”product-categories”> <h3>Categories</h3> <select class=”form-control shop-filter” onchange=”location = this.value;”> <option selected value=”/shop/”>All</option> <?php foreach ( $categories as $category ) { ?> <option value=”<?php echo get_term_link( $category->term_id… Read more »

Continue Reading

How to Remove Default HubSpot CTA Styles

Category: Code Snippets

HubSpot allows marketers to create custom styled CTA buttons. This can be a problem if you have a large team who may not know how to follow brand guidelines. This creative freedom can make buttons look inconsistent across your website. You could educate all of your users to never create custom styles. Or you could… Read more »

Continue Reading

Add Custom Info Widget to WordPress Admin Dashboard [code snippet]

Category: Code Snippets

The snippet below helps you customize the default WordPress admin dashboard. Sometimes the dashboard contains too much information and you want to simplify it for you or your clients. The code below will help you hide existing widgets and add a custom one. In this example I added a user guide to help new users… Read more »

Continue Reading

How to Redirect WWW to non WWW WordPress [htaccess snippet]

Category: Code Snippets

Below are two code recipes for your htaccess file to redirect different versions of your domain. Once you have things added you can use this redirect testing tool to verify all the versions of your domain are redirecting properly.

Continue Reading

HubSpot CMS Site Search Input Module Override

Category: Code Snippets

HubSpot provides a default module to perform a site search. By default it searches website pages and blog posts. But what if you want to override this and only search blog posts? Below is an embed snippet to help you do just that.

Continue Reading

Scale Up and Crop an Image WordPress [code snippet]

Category: Code Snippets

In WordPress you may need to increase the size of all thumbnails but WordPress does not res up the images to prevent distortion. Using the method outlined in this example you can use object-fit to make undersized images fit your desired aspect ratio. .img-crop__polyfill image is sized to the desired dimensions. This will help keep… Read more »

Continue Reading

How to Get a Wistia Video Thumbnail Without the API

Category: Code Snippets

Wistia video provides some handy embed codes for your videos but what if you want to create a custom player or use the thumbnail image by itself. You can use their API but the setup could me more complicated than you need. Thankfully Wistia provides Oauth url’s used in WordPress to grab the data for… Read more »

Continue Reading

How to Link to Module Fields to Theme Images in HubSpot Themes

Category: Code Snippets

When building HubSpot themes you often want to have default images referenced from inside your theme folder. You would think adding a relative link would work but you actually need to add it inside this hubl function to get it to work get_asset_url() Learn more about building custom modules in HubSpot. “default” : { “src”… Read more »

Continue Reading

How to Update Navigation Menu in HubSpot Content Staging

Category: Code Snippets

When using content staging in HubSpot you can easily test and preview design changes but the menu does not update to use the new staging domain. So you have to preview each page individually. This can be an issue when you are working on a HubSpot website rebrand and the client needs to click through… Read more »

Continue Reading