Compatibility requests with older browsers are becoming less frequent, but we had another one recently, and I wanted to give it a try while still utilizing our favourite plugins.
Read MoreI 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 MoreGreat for repeating content columns, where additional information appears inbetween rows on click.
Read MoreComes in handy working with breadcrumbs, and sub-pages showing parent’s title.
Read MoreI needed to display reviews from the Reviews page on a few select Pages and Products in a Shopify theme.
Read MoreSort post content alphabetically, and divide each letter section with the appropriate letter.
Read MoreThe 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');
}
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 MoreSimple function to check is WooCommerce Product is virtual. Can be used in the Cart or on Product page.
Read MoreRan 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 MoreI use Page Links To a lot. Probably on every website I’ve built for the last five years.
Read MoreIf 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 MoreHandy snippet for updating the default title text on a Comment Form.
Read MoreWhen 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 MoreDisable the default from WordPress version 5.4 that forces fullscreen mode as the default view in Posts, and Pages.
Read MoreI used this on a custom page template showing only Past Events.
Read MoreA 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 MoreNeed 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 MoreIdeal for working with plugins where the fields are not available for editing / customization.
Read MoreI 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 MoreRemove Tabs from the sidebar, admin columns, and Post.
Read MoreWhen a user is added to WordPress, their insert image settings have Link To Media set as the default option.
Read MoreI’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 MoreThis comes in handy if the ecommerce store does not ship any physical materials (e.g., downloadable, e-tickets, online classes, membership, etc).
Read MoreI 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 MoreI really enjoyed customizing this. Check out more from the author of this snippet at the link below.
Read MoreThe below is used to check between two date fields and display only the items that fall within that parameter.
Read MoreI’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 MoreStyle images differently according to weather the image is landscape, portrait, or even square.
Read MoreThis also works with Post Types created by Plugins.
Read MoreThese are some of the functions I use in my custom themes to setup my own defaults in Gutenberg.
Read MoreIf files within /woocommerce are being ignored, add support for Woocommerce as follows:
Read MorePlace the below in your functions.php to add your own custom font options to the core Paragraph Block.
Read MoreBrute 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 MoreThe Google Font Library is a great resource for free fonts.
Read MoreWorking 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 MoreTo 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 MoreYouTube recently disabled the rel=0 option for disabling the trailing thumbnails at the end of videos.
Read MoreBuilding 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 MoreThank 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 MoreIf 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 MoreWant 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 MorePassword 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 MoreWorking 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 MoreAutosort data on a page from a hash URL using the following snippet and related HTML.
Read MoreMost 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 MoreRestrict access to backend based on user role:
Read MoreWorking with fixed headers and absolute-positioned drop-down menus can be difficult to adjust with CSS alone.
Read MoreWordPress 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 MoreAdd 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 MorePlace 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 MoreI used this recently coupled with breadcrumbs to prevent certain items from showing on the top-most items in page hierarchy.
Read MoreWorks great if you’re using a sub-menu that shows related-level items when on a page.
Read MoreWhen 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 MoreUse the following snippet to return the Featured (starred) Products from the WooCommerce Product listing.
Read MoreSVGs, when resized, will not scale in proportion in older versions of Internet Explorer.
Read MoreSlick Slider has pause and play functions available, but they are not easily enabled.
Read MoreIf you need to add Tags to your Custom Post Type, use the following snippet.
Read MoreIf you’ve run into an error where your site is loading all of your Pages as Blog or Archive.
Read MoreGreat to use on product pages to reveal varied standardized text from the template when Products use shared terms like colours, or sizes.
Read MoreWhen 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 MoreiOS 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 MoreFonts will render differently across browsers, and sometimes even when different colours and background are being used.
Read MoreDisplaying 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 MoreI’ve always wanted to apply automatic inherited styles to pages that are child pages of a custom template, and now I can!
Read MoreSimple jQuery function to toggle between multiple containers on click.Filter links HTML:
Read MoreWorking 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 MoreSlick 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 MoreWorks in relationship with has_children();
Read MoreEnable auto-scrolling to error messages in Gravity Forms by adding the following snipped to functions.
Read MoreI have used counting classes so many times, but never understood them to this extend until I found this example.
Read MoreWorking within different loops different ways has it advantages …
Read MoreUsing fixed backgrounds on mobile devices can be tricky, as not all mobile devices support background-attached: fixed.
Read MoreThere is probably a simpler way to do this, but so far this method works for me …
Read MoreComes in handy if you’re adding links to multiple external sources or components, such as locations, company websites, or PDFs.
Read MoreI 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 MoreSpam and malware bots are being programmed smarter, and they can sometimes target email urls that are placed in the content area.
Read MoreThe following works in multiple languages and can be used inline:
Read MoreAdd information to enqueue to choose where your scripts and styles load.
Read MoreThis example works great with Isotope, Masonry, and jQuery filters.
Read MoreThe 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 MoreThis makes working with filters so much easier.
Read MoreI 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 MoreEverywhere 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 MoreAfter 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 MoreI previously attempted this using post_parent, grandparent and ancestor information in an if statement, but I find this method is cleaner.
Read MoreHave you ever wanted to create a layout that updates automatically based on the number of items shown?
Read MoreSimilar to WPML, you can create if statements using WP Multilang
Read MoreI’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 MoreThe below example uses WordPress Tags.
Read MoreEver wonder how to set the background colour for the page when printing via CSS?
Read MoreI 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 MoreAdjust your post feed according to which Posts are using Read More tags.
Read MoreEver thought about customizing Time.ly’s All-in-One Event Calendar layouts on your website?
Read MoreThis 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