WordPress

add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
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

Works with Gutenberg.

Read More

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

Read More

Help visitors sort content on your website by adding filtering options to your Posts.

WP Popular Posts Plugin plugin used in the below example in order to add support for filtering Most Popular items (determined by number of views).

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

How to remove the UL and Div containers on the wp_nav_menu() function.

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

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

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

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

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

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

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

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

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

Works in relationship with has_children();

Read More

Working within different loops different ways has it advantages …

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

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

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

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

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

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

Add this to wp-config.php if you’re unable to perform updates on your WordPress installation.

First check that your folder permissions are correct, and there are not any plugins installed, or prompts within wp-config.php that will prevent updates or installations from being performed.

Read More

Comes in handy if you have items saved in a Plugin’s additional folders that you’d like to only be accessible to your paid / subscribed users.

Read More

I’ve been running into “Uncaught referenceError: jQuery is not defined” a lot lately when working with scripts and plugins that I’ve used for years. It’s unbelievably annoying to have something that’s worked one way for most of my career to suddenly stop working and bring up errors.

Nonetheless, I’ve found a solution!

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

Handy trick I use to show / hide a content area in a custom layout if there is no content.

if( '' !== get_post()->post_content ) {
// do something
}

Further notes:

If the above fails to work, particularly within the loop, replace get_post with $post.

Source.

Read More

Download a plugin to repair the visual editor loading text as white, and not displaying any buttons in Internet Explorer 11 here.

Sourced here.

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

If your Custom Post Types are not showing up in your archive.php or category.php templates (even with ‘has_archive’ => true enabled within the register_post_type function), you may need to do some additional theme adjustments!

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

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

Create a custom Date Archive using the following snippet.

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

Htaccess file of compiled sources to block referrer spam and bad bots. Updated regularly, various sources.

Read More

The default markup for previous_post_link and next_post_link can be difficult to style and adjust using CSS alone.

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

Incredibly handy function that I wish I found ages ago!

WordPress natively supports adding the class “parent-pageid-##” to child pages, but does not do so to ancestor pages. Thanks to TechTabby for putting this function together.

Read More

Updating your Reading Settings within WordPress affects all templates of your site:

Read More

I use Custom Post Types a lot at work, and taxonomies are a great way to help organize and control their display on Category and Custom Template pages.

Read More

Re-skinning live sites can be tricky and sometimes unavoidable.

I use the following snipped to target updated versions of stylesheets, headers and footers, and lock them to my user ID so all of the changes are only visible to myself until the theme is ready to launch.

Read More

By default, Category templates bring in the words “Category Archives:” ahead of the category name with most themes, and this isn’t always ideal. When theming Archives separately from Category pages, it’s necessary to target the title of Category to edit the default text.

Read More

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

Read More

Detect if a product is in the cart and add it by product ID as soon as a visitor is on your website.

Read More

Error establishing a database connection is my least favourite error message. There’s so many things that you need to check, and the error itself (imo!), does not provide very much direction.

Read More

Adjust the supports array of your Custom Post Type within functions.php to enable Menu Order filtering by adding ‘page-attributes’:

Read More

Found a handy function over at WP Beginner that allows you to hide the Toolbar for anyone that does not have Administrator access.

Read More

Here is the code that I’ve been waiting for!! Found here, you can use this to link to the default wp-login.php page using an image, or customize it further to take advantage of the pages generated by plugins like TML.

Read More

This is a blanket solution that will help you hide the admin bar for everyone, and save time with having to provide the “hide toolbar” info to all users.

Read More

Based off of this entry and modified from this source trail, the below snippet will help you embed featured images and backgrounds, and make child pages inherit them from parents.

Read More

WordPress does not natively support uploads for ePub files.  To enable this support, add the following to functions.php

Read More

Follow these steps when placing WordPress in a subfolder.

Read More

Follow this WordPress Codex example and this support forum comment, add this into your header.php file and style the resulting body class accordingly

Read More

Post Feed

WordPress

May 07, 2015

Simple post feed.

Read More

Customize your theme further by enabling the ability to show the caption when using the Featured Image.

Read More

Adding dynamic slugs to your body class can help enhance the ability to style your theme.

Read More

If page IDs or other classes are not appearing in the source code for a site that you’re working on, check the header.php file to see if body_class(); is being applied to the <body> tag.

Read More

Working with large sites that have cross-over content, sometimes it’s necessary to know how to bring multiple taxonomies into a single query.

Read More

This attribute needs to be fed an array, even if a single item is being called, or it will not function properly

Read More

When creating parallax websites, or websites where all of the content is visible on one area, use the following to keep users from getting sidetracked from other areas of the website

Read More
add_action('get_header', 'my_filter_head');

  function my_filter_head() {
    remove_action('wp_head', '_admin_bar_bump_cb');
  }

Sourced here.

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.