Tips

I needed to display reviews from the Reviews page on a few select Pages and Products in a Shopify theme.

Read More

Alphabetized Glossary

php

October 07, 2020

Sort post content alphabetically, and divide each letter section with the appropriate letter.

Read More

The site health widget can alert you to issues on the website, but this can also be confusing to clients and increase maintenance requests to resolve “issues” when the website is functioning properly. Hide this widget using the following snippet.

Place in functions.php

add_action('wp_dashboard_setup', 'remove_site_health_dashboard_widget');
function remove_site_health_dashboard_widget()
{
    remove_meta_box('dashboard_site_health', 'dashboard', 'normal');
}

Source.

Read More

Annual events (festivals, haunts, etc.) generally occur within the same month each year. Use this function to force update all of your calendar views so scheduled events are seen first without having to navigate through month / week views.

Read More

Simple function to check is WooCommerce Product is virtual. Can be used in the Cart or on Product page.

Read More

Ran into an issue with an e-commerce Product quantity field where the up / down arrows would not show, and were required to indicate more than one item could be purchased.

Read More

I use Page Links To a lot. Probably on every website I’ve built for the last five years.

Read More

If you’ve forgotten what email and password you used to setup a website (or entered your email wrong, or your website isn’t sending reset password links to you!), you can setup an admin user via FTP using the following function.

Read More

Handy snippet for updating the default title text on a Comment Form.

Read More

When content is set to Password Protected, the word “Protected” appears in front of the title in the content area within loops, and on single Post and Pages.

Read More

Disable the default from WordPress version 5.4 that forces fullscreen mode as the default view in Posts, and Pages.

Read More

I used this on a custom page template showing only Past Events.

Read More

A fixed header can cause auto-scroll content to be covered. Use this function to offset the scroll to the height of the fixed container.

Read More

Need to add varied styles to rows, but don’t want to program it in the backend? Or add ID numbers to rows in order to setup toggles?

Read More

Ideal for working with plugins where the fields are not available for editing / customization.

Read More

I needed to query multiple post types and specific taxonomies and meta for a featured banner on a website, and found that using an array for post_type wasn’t working with the tax_query.

Read More

Disable Tabs

php

April 15, 2020

Remove Tabs from the sidebar, admin columns, and Post.

Read More

When a user is added to WordPress, their insert image settings have Link To Media set as the default option.

Read More

I’ve seen a lot of suggestions online to copy the Logout link shown in the WordPress backend into a Custom Link when using wp_nav_menu().

However, this will redirect users to the Logout Confirmation screen, and they will be prompted to logout once more.

Read More

This comes in handy if the ecommerce store does not ship any physical materials (e.g., downloadable, e-tickets, online classes, membership, etc).

Read More

I stumbled across this while creating a query of Custom Post data, where the content needed to be laid out in columns, and rows of equal height.

Read More

I really enjoyed customizing this. Check out more from the author of this snippet at the link below.

Read More

The below is used to check between two date fields and display only the items that fall within that parameter.

Read More

Count Divs with jQuery

jQuery

December 25, 2019

I’ve been working with a few plugins lately that have templates, but do not allow for editing for the loop, so I’ve been unable to add counters with PHP.

Read More

Style images differently according to weather the image is landscape, portrait, or even square.

Read More

This also works with Post Types created by Plugins.

Read More

These are some of the functions I use in my custom themes to setup my own defaults in Gutenberg.

Read More

If files within /woocommerce are being ignored, add support for Woocommerce as follows:

Read More

Place the below in your functions.php to add your own custom font options to the core Paragraph Block.

Read More

Brute Protect settings within JetPack add security against malicious login attempts. Occasionally, these settings can lock the login page completely, even with your IP address added to the whitelist.

Read More

The Google Font Library is a great resource for free fonts.

Read More

Working with Gutenberg, I’ve learned how to build custom blocks to show content inline on a page, but I thought there could be an easier way that building a block, or a custom template.

Read More

To add a Custom Post Type to the Appearance > Menus section of the backend, add show_in_nav_menus => true to the Post Type args.

Read More

YouTube recently disabled the rel=0 option for disabling the trailing thumbnails at the end of videos.

Read More

Building a custom website for a client or a friend, it might be easier to setup the site / brand colours as the defaults available in the Colour Settings dropdown.

Read More

Thank you so much to Chittaranjan for posting this on Stackexchange…

This function targets wp_nav_menu by it’s theme_location, and dynamically adds a Login / Logout button to it, including nonce.

Read More

If you’re inundated with blocks that are not being used in your Theme template, and you would would like to hide unused blocks; use the default settings within WordPress core to remove the blocks from the “Add Blocks” option.

Read More

Want to hide the editor from the WordPress editor because:

  • there are several users accessing the WordPress backend
  • a client has requested this feature be disabled
  • you never user it

Add the following line to wp-config.php above the “That’s it, happy blogging” comment line.

define('DISALLOW_FILE_EDIT', true );
Read More

Plugins, and Custom Post Types can add to your search results, and this isn’t always easy to adjust. You can edit your Post Type settings to exclude from search, but sometimes you need these items searchable in some areas of your website (like a directory), but not in the general search.

Read More

Password Protected items show up in Search Results for logged in Users. This can be confusing when linking to those items for users without accounts.

Read More

Working on client websites with installed plugins, use the below information to update labels in the backend sidebar so the updating information is easier to find.

Read More

Press play on the video when the slider loads to address the issue.

jQuery('#banner').on('init', function(ev, el){
jQuery('.videoWrapper').each(function () {
this.play();
});
});

Source.

Read More

Autosort data on a page from a hash URL using the following snippet and related HTML.

Read More

Most of the examples for this that I have seen were for adding images to the column area, and did not explain how to fix column content brought in by custom post types.

Read More

Restrict access to backend based on user role:

Read More

Working with fixed headers and absolute-positioned drop-down menus can be difficult to adjust with CSS alone.

Read More

WordPress supports a bunch of different file types already, but working within different industries, and creating online databases / libraries for clients requires the need for the addition of file types that are not supported by WordPress.

Read More

Add show_in_rest => true to the array for the custom post type to enable the gutenberg editor, and to the taxonomy to have the item appear in the Gutenberg editor’s sidebar.

Read More

Place the below snippet in wp-config.php to prevent your WordPress install from prompting for the username and password for FTP when performing updates.

Read More

I used this recently coupled with breadcrumbs to prevent certain items from showing on the top-most items in page hierarchy.

Read More

Works great if you’re using a sub-menu that shows related-level items when on a page.

Read More

When adding content, sometimes it’s necessary to add in extra non-breaking spaces to adjust spacing on desktop. Even some plugins (Shortcodes Ultimate) will create additional paragraph tags in the content area that cannot be removed from the editor.

Read More

Use the following snippet to return the Featured (starred) Products from the WooCommerce Product listing.

Read More

SVGs, when resized, will not scale in proportion in older versions of Internet Explorer.

Read More

Slick Slider has pause and play functions available, but they are not easily enabled. 

Read More

If you need to add Tags to your Custom Post Type, use the following snippet.

Read More

If you’ve run into an error where your site is loading all of your Pages as Blog or Archive.

Read More

Great to use on product pages to reveal varied standardized text from the template when Products use shared terms like colours, or sizes.

Read More

When using Variable Products in WooCommerce, the default “Choose an option” text is pretty boring. You can use a function to customize it to match your specific offered Products.

Read More

iOS Hover Events Fix

jQuery

February 13, 2019

iOS devices when programmed to use “hover” with css will often ignore this effect in handheld and touchscreen devices, forcing the user to double-click in order to reveal toggled or hidden content.

Read More

Fonts will render differently across browsers, and sometimes even when different colours and background are being used.

Read More

Displaying an image from an ACF custom field is slightly different on an Archive / Single page, versus on a page, or in a regular loop.

Read More

I’ve always wanted to apply automatic inherited styles to pages that are child pages of a custom template, and now I can!

Read More

Simple jQuery function to toggle between multiple containers on click.Filter links HTML:

Read More

Offset Anchor Tag

HTML

January 09, 2019

Working with CSS fixed headers and HTML anchor tags can be a little tricky. The jump point will need to be offset by the height of the header, and other fixed elements.

Read More

Slick Slider is a great plugin for creating custom carousels on websites. It has a built in navigation option for the carousel as well: asNavFor.

Read More

Works in relationship with has_children();

Read More

Enable auto-scrolling to error messages in Gravity Forms by adding the following snipped to functions.

Read More

I have used counting classes so many times, but never understood them to this extend until I found this example.

Read More

Working within different loops different ways has it advantages …

Read More

Using fixed backgrounds on mobile devices can be tricky, as not all mobile devices support background-attached: fixed.

Read More

There is probably a simpler way to do this, but so far this method works for me …

Read More

Comes in handy if you’re adding links to multiple external sources or components, such as locations, company websites, or PDFs.

Read More

Get menu_order Value

WordPress

October 31, 2018

I usually use a counter to show show items in a list, but I was recently working with numbered Modules, and needed specific values associated with each Page / Post, so instead I found myself using menu_order.

Read More

Spam and malware bots are being programmed smarter, and they can sometimes target email urls that are placed in the content area.

Read More

The following works in multiple languages and can be used inline:

Read More

Add information to enqueue to choose where your scripts and styles load.

Read More

This example works great with Isotope, Masonry, and jQuery filters.

Read More

The Post Object field in ACF grabs all Post Statuses in the WordPress backend, but does not provide filtering within the plugin’s interface to select only Published Post items.

Read More

Get Terms as Checkboxes

php

September 19, 2018

This makes working with filters so much easier.

Read More

I work with Theme my Login and build member-based content areas within websites a lot. Often, the login forms that I use do not bring in the JetPack Protect prompt automatically, and users will have to submit the form two or three times in order to successfully login (once to see the humanity check, once to login, and possibly a third time depending on cache and browser settings).

Read More

Everywhere I’ve checked for this information suggested installing additional plugins to enable support for this feature, or said that it was a lengthy and complicated process … but that is not true.

Read More

After converting a non-secure website to use SSL, bookmarked, and cached URLs can still be accessed from user browsers and cause your website to appear broken when the stylesheet does not load in SSL.

Read More

I previously attempted this using post_parent, grandparent and ancestor information in an if statement, but I find this method is cleaner.

Read More

Have you ever wanted to create a layout that updates automatically based on the number of items shown?

Read More

Similar to WPML, you can create if statements using WP Multilang

Read More

I’ve worked with a few membership-based websites, and found this method to be the easiest way to ensure layout customization for different user types:

Read More

The below example uses WordPress Tags.

Read More

Ever wonder how to set the background colour for the page when printing via CSS?

Read More

I think one of the reasons RSS feeds are not as popular (as they should be) is due to the fact that they are not optimized to their full potential.

Read More

Adjust your post feed according to which Posts are using Read More tags.

Read More

Ever thought about customizing Time.ly’s All-in-One Event Calendar layouts on your website?

Read More

This method comes in handy if you’re working with plugins and are unable to edit theme files, or external files at the risk of losing your styles with an update.

Read More

Great for drop downs, fly outs, and mobile menus.

Read More

Twig reminds me of liquid, but it’s more difficult to understand. It took me a while to find an example of how to do this, so I’m not losing it!

Read More

It’s unfortunate that the Time Field in Gravity Forms does not have more custom options available.

Contrarily, the Date Field, allows for a calendar icon, and drop downs, but the Time Field doesn’t have a default placeholder option to populate the current time, or an alternate view to allow for drop downs showing 12 or 24 hour time.

So I had to turn to jQuery…

Read More

Below is an example of the_post_navigation customized to include an image and custom text for previous and next.

Add this snippet to your functions file, link to your images, and then call it where you would like the_post_navigation to appear.

Read More
katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.