php

ACF Fields added to the template outside of the_content() will have this problem.

Read More

Customizing the Theme you regularly use help streamline time spent developing!

update_option( 'thumbnail_size_w', 300 );
update_option( 'thumbnail_size_h', 300 );

update_option( 'medium_size_w', 600 );
update_option( 'medium_size_h', 600 );

update_option( 'large_size_w', 1150 );
update_option( 'large_size_h', 1150 );
Read More
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
Read More

Use show_in_rest to enable Gutenberg block editor on custom post types.

Read More

Common issue on shared hosting. Debug is unable to be deactivated due to host settings.

Solution:

ini_set('log_errors','On');
ini_set('display_errors','Off');
ini_set('error_reporting', E_ALL );
define('WP_DEBUG', false);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
Read More

Works in single and page templates. Add at the top of the file.

<?php
/*
Template Name: Full-width page layout
Template Post Type: post, page, custom-post-type
*/

Source.

Read More

Setup a stylesheet for the default login screen, and update the heading url.

Read More

Membership Site Edits

WordPress

February 02, 2022

Membership type websites need to be customized to prevent Subscribers from accessing certain areas of WordPress core. After setting up a front-end Profile page or Dashboard, it is necessary to redirect to these areas for the appropriate user types.

Read More

This will search Posts and Post Types for Taxonomies that match the search terms and will return the Posts (not the taxonomies).

Read More

Handy if you’re using the default category as “All Products” and want to prevent unrelated items from appearing related when no other categories are selected.

Read More

Last Item in Array

php

December 08, 2021

Useful to add custom styles or punctuation to last item in an array.

Read More

This affects all post types. Wrap in conditions to reduce appearance. Featured Image column will appear last.

Read More

Use to convert text with spaces into lowercase data with dashes so it can be used for element tags.

Read More

Weekday Countdown

php

October 20, 2021

Worked on a subscription service website recently that had specific weekly cutoffs for ordering in order to have ordering available for the following week.

Read More

If Term is Parent Condition

php

September 22, 2021

Check if the current term is a parent and allow for different formatting based on conditions.

Read More

Two examples provided comparing the regular select and multi-select field functions for Gravity Forms.

Place in functions.php. Update filter number with the form ID.

Read More

Place this in functions in order to create your own custom block styles and render them in the editor.

Read More

Working on new layouts on a live site? Client unfamiliar with WordPress and how to login and view Draft pages?

Use this in your header file to generate private content links for review.

Read More

In the past I’ve manually changed the content of the jquery file (I know, bad bad bad), or used a plugin to make this editable for me (also, bad bad bad). This snippet helps avoid those two methods and lets the edit occur within your theme.

Read More

I recently built a website with a large featured banner on their home page, and events page. Banners information was held in a Custom Post Type, and Events were created by The Events Calendar plugin.

The client wanted to combine these two items to show all of the banners on the Home page, to more readily promote their events.

Read More

Great for repeating content columns, where additional information appears inbetween rows on click.

Read More

Page Depth Condition

php

December 09, 2020

Comes in handy working with breadcrumbs, and sub-pages showing parent’s title.

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

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

Read More

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

Read More

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

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

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

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

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

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

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

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

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

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

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

Works in relationship with has_children();

Read More

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

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

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 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

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

Read More

I use this fairly often. I find working with plugins I already have installed is better than installing additional plugins to resolve the issue I’m trying to accomplish more reliable.

Read More

I’ve always wondered how to do this, and now I have an example on hand that I can refer to in the future. Comes in handy if you’re using custom navigation / filters with categories or terms.

Read More

Turn your Gravity Form into a booking calculator!

Read More

If your website has several News / Blog contributors, you can display a list of Authors by role and link back to their individual landing pages (author.php).

Read More

Check if Page has Children

php

January 24, 2018

Use the following function to determine if the current page you are on has any child pages. 

Read More

WordPress has so many different “stock” template types that are not used on every type of website. For example, a small business website, may not use the Archive, Blog or Single page layouts.

In my seven years of building WordPress website, I have yet to come across a single client that uses the “Attachment Page” layout (properly, at least).

Read More

Working on heavily cached servers with limited access to cPanel / server resources makes it difficult to apply website updates in a timely fashion.

Read More

A handy snippet that can be used in conjunction with Advanced Custom Fields as well as the WordPress default custom fields to remove Posts, Pages and Custom Post Types from feeds.

Read More

If you have transitioning content on your website, such as a Templated Page that will be launching at a certain date or time, you can setup a custom countdown landing container, and use a custom field to automatically update the content at a scheduled date and time.

Read More

On the category archive, or the single post page, use the following loop to retrieve the name, slug or ID of the top most category to use as a header, or link.

Read More

Building custom menus and filters is unavoidable. If you’re not comfortable triggering the active item with jQuery to add an active class, you can find the current page ID, and use existing WordPress CSS classes to reapply styles already within your stylesheet.

Read More

Enable background and text colour changes within your template using Advanced Custom fields.

Read More

I work with Gravity Forms, and Gravity Forms User Registration a lot, so being able to redirect users to a custom template instead of a front end user profile (such as Theme My Login) would be preferred.

With Gravity Forms, I’m able to enable custom notifications based on the fields that are updated.

Read More

If you’ve built a custom Registration Page with a form that is gathering all of your customer’s information, the default WordPress Register link, has become null and void.

Read More

I recently worked in a website that had multiple skins within a single domain. The different themes were controlled and activated by their related parent pages. I’ve already gone over how to add an ancestor class to the body, but I needed to add a couple additional features to this website as well.

Read More
<?php $tax_slug = get_query_var( 'taxonomy_category' ); ?>

Comes in handy if you’re working with custom post types, or external plugin archive pages.

Read More

Use with Link to Top-most Page in Hierarchy for a more dynamic nested sub-navigation menu.

Read More

Change the default number of words returned by the_excerpt() using this function:

Read More

A deep number of page levels in a website can make navigation difficult for front end users. In addition to breadcrumbs, it is worthwhile to maintain your Top-Most Page Title in all areas to help your visitors find their way between the hierarchical sections of your site.

Read More

Get_terms does not natively support exclude children. Here is a function that you can use to help keep your front end organized, and structured.

Read More

More often than not, content is added to a website for aesthetic purposes (carousels, widgets, call to action buttons, etc.), not necessarily to provide information.

Read More

Setup page titles for different page levels using the following statement. Below example is using the Thematic WordPress Theme.

Read More

The All in One Event Calendar by Time.ly is extremely flexible if you need to place several widgets and event shortcodes on your website.

Using the Plugin to generate your own custom query and feeds of your Event information is not very intuitive, and finding valid information a long process.

Read More

Similar to my Subnavigation Function, this will display widgets and adjust column widths if widgets are active on the page.

Read More

This is a continued modification of my earlier post for toggling multiple embedded YouTube videos into a larger playing div.

Since I was already using Posts to embed the videos, enabling a Featured Image for a Poster, and using the Content editor for a text overlay was a simple feat to accomplish.

Read More

Template layouts (and client requests) will often require a list of categories to be laid out in a specific order to draw attention to different content.

Read More

The Advanced Custom Field plugin’s Taxonomy field type has been giving me a hard time for several hours now … This plugin is so versatile, that there is simply not enough documentation on the website, despite all of the amazing work done by Elliot Condon.

Read More

Sometimes when building arrays for directories, or archives, we have to list all of the content (even the empty ones).

In the unfortunate circumstance when you have no choice but to use the foreach loop, here is a handy workaround to check if the loop is empty, and display a custom message

Read More

You can achieve more stylistic versatility within your WordPress backend, and theme, if you’re able to inject fonts within the WYSIWYG editor.

This is possible if you are using embedded fonts, or if you are using fonts from a hosted library using the below function, and the Advanced TinyMCE plugin addon.

Read More

Add Class to Elements by Count

php

September 22, 2016

Creating dynamic layouts can make it easier on your clients (and yourself) to update your content without worrying about checking the front end to make sure the selections are correct, or having to update various posts / content areas following updating new content.

The following example shows how to add a colour class to your container using the_loop, php and with some CSS adjustments, possibilities are endless!

Read More

Discovered this handy cheat-function over here and it was just what I have been looking for to help me add further customization to all the Custom Post Types that are created by Plugins upon installation.

Read More

Great way to hide categories from the front end if they are reserved for a different purpose:

Read More

Sometimes it’s necessary to further customize archived data into sortable sections (organized by date, like below, or category), so it’s easier for visitors to find what they’re looking for at-a-glance.

Read More

If Is User by ID

php

June 07, 2016

Found this demonstrative function in the wp_get_current_user(); WordPress documentation, as a way to test if a user is logged in

Read More

Useful way to grab the title from the page ancestor, and setup child page titles.

Read More

This example will allow for a class to be added to the current child page so it can be custom styled.

Read More

Sourced here, this will help filter content posted by multiple users on a blog.

Read More

Add or replace the contents of searchform.php with the following in order to enable a dynamic search field with an image search icon in, similar to the image below:

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.