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

CSS 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

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

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

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

A type of layout you might use to compare service types offered by your client may require you to toggle back and forth via a button.

Read More

Turn your Gravity Form into a booking calculator!

Read More

Use the below example to custom format the date displayed when querying Tribe events. 

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

If you’re offering free downloadable items on your website, and don’t require site visitors to register for access to the items, you can use the following snippet to add a download link to your single-product template.

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

Use ‘eventDisplay’ => ‘list’ in conjunction with the WordPress backend Settings for Tribe Events Calendar to prevent recurring events from showing up in custom loops.

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

Use the following snippet to identify the tallest div in the sequence and force all the same level divs to match height with it.

Read More

Web AIM Tips

Web

January 31, 2018

Working with Web Accessibility in Mind is simple (if you know what steps to keep in mind).

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

Putting this here so that I don’t have to keep Googling and bookmarking them.

Enjoy! 🙂

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

Typically, I use classes like .desktop, .tablet, and .mobile combined with media queries to switch between different-sized elements when building a website, in order to avoid loading the high resolution images on the handheld devices.

I find the class method a little tedious, and not as intuitive as I would like, so I’ve been looking for alternate ways to perform these transitions.

Read More

Smooth Scrolling

jQuery

December 27, 2017

I hate anchor tags, and I hate even more that there isn’t an easy point / click way for them to be added into a website using the WordPress editor.

Nonetheless, clients request them a lot, and they don’t like the “jumping” that they cause when the anchor links are on the same page.

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

I’ve run into a couple of issues where a website will break due to the site being SSL secured but the stylesheet refusing to load as SSL.

Read More

If your design is in a tiled layout, or you have a series of blog entries in rows and would like to show the “Read More” buttons below the lead-in text at the same height, this is a pretty straight-forward fix.

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

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

Sourced here, this handy snippet can help you update your theme templates to show multiple organizers.

You can take this further, and modify the code to display it this information in a loop, or within a themed version of the template.

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

Create a custom Instagram slider for your site using jSON and the following instructions…

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

Another way to style images dynamically based on window sizes is shown below.

If you’re using images that are set to a 2:1 ratio (where width is two times greater than the height), you can use the example below to dynamically scale the height of the containers as windows are loaded / resized.

Read More

Using tiled image layouts in responsive design can sometimes be tricky to set the height, especially if you want all of the image containers to consistently remain the same height.

Read More

Tribe Events Calendar is a very user friendly plugin, and I highly recommend it for WordPress beginners.

Within the WordPress backend, Tribe’s settings and posts do not have an option to customize the Website URL, Organizer URL, and Venue URL to make them open in new windows.

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

Use HTML and CSS to toggle reveal the search input field. 

Read More

Use the follow snippet to remove the text, or update it with your own heading:

Read More

Theme My Login and WPML

Plugins

September 06, 2017

Theme my login can enhance members’ functionality for multi-lingual websites if you use the following snippet to redirect the login form to the appropriate language.

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

Sometimes, when working with designers, the content of a multilingual website will end up on a single landing page. In this event, using suppress_filters to get_posts associated with the active language will provide posts in both languages, and not provide the side-by-side translation effect desired.

Read More

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

Read More

Check all values of a div, by class name, and return only values matching the search criteria. Below is an example where this search filter is applied to a staff directory.

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

Tribe Events Calendar is a great plugin, that has a lot of very simple queries you can use to create calendar feeds within your templates.

If you have an event on your website, and a calendar that’s launching before weeks (or even months) before the event is taking place, you can use a function to setup a start date for your calendar. The Calendar’s default page views (month, day, list) will load starting from the date entered in the function.

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

Gravity forms is great an excellent plugin, and has tons of addons that you can use to further enhance it’s functionality on your website.

Read More

Use this foreach loop (inside of a query) to grab Product galleries from WooCommerce.

Read More

Sometimes Custom Post Types are built to organize and filter information, such as creating a Research archive or a Staff directory.  That content is meant to be seen on the front end in the single.php template.

However, when creating a Custom Post Type for a rotating Banner, or a single page listing all of your Testimonials, the single.php template is moot.

Read More

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

Read More

If you’re working with WooCommerce add-ons (e.g., Bundles), use this function to cycle between different WooCommerce Product Types, in order to display queries and functions in specific templates (operates similar to an if statement).

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

Super simple jQuery data filter, that can easily be made dynamic using a query like so:

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

Coupon Creator Pro is a great plugin to highlight offers and deals available to your customers on your website. The coupons come with different themes available, allow for both image and text injection, and are responsive, as well as printable.

Read More

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

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

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

Use this function if you find yourself having to force your CSS styles with !important in your Child Theme.

Read More

The default placeholder image in WooCommerce does not adjust according to image changes made within the Settings (e.g., changing the number of columns from 4 to 3 will result in a smaller placeholder image).

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

Create your own media page from posts with embedded YouTube videos, and toggle the list of videos into a larger div to play the content using the steps below.

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

Using buttons and jQuery to filter and sort Posts on a website can be fun! Unfortunately, as your content grows, it can also become space consuming, and difficult to read.

Convert a list to a dropdown, and toggle the display of the items via class with a jQuery function.

Read More

Gravity Forms is a powerful plugin!

Using this function, display values in the select dropdown field dynamically, based on parameters you set in the foreach loop.

Read More

Clients like to keep themselves organized, and will often send all of their images inside of a Word document, or PowerPoint presentation, to keep the image coupled with the instructions for their web updates.

Read More

When the order of elements in your desktop layout differs from the order of items in your mobile layout, it might be prudent to load items based on the screen size using a jQuery if statement.

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

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

These are my go-to media queries when browser testing different versions of Internet Explorer

Read More

This snippet will allow the Single product layout to display in the same layout as your installed theme.

Read More

This is a great way to get trigger content loading on the page automatically. Visitors can then use filters enabled in the Search Filter to customize their search.

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

Used in HTML, this will convert a hard-coded address into an embedded map within an iframe

Read More

BloodForge Smoke Effect Plugin is easy to setup and integrate in html and WordPress websites. Based on a particle smoke effect posted by Jonny Cornwell.

Can be used to apply a smoke / fog effect to a div as a background, or using canvas. Includes support for modern browsers (will slow down page loading).

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

Useful snippet to gather additional information about site visitors for forms that do not capture a lot of data.

Will honour user settings if IP address is set to private or reserved.

Read More

A simple alternative to using HTML5 audio controls. Link directly to an audio file in the page, or use this method within a loop.

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

Add one of these snippets to functions.php if you’d like to customize your WooCommerce product content.

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

Add a poster to an html embedded video to prevent the black background from displaying on screen while the video loads:

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

Cross browser testing mobile devices can be very confusing when you take into account the various resolutions different devices.

Read More

Make your website content more dynamic and interactive with this handy feature.

Read More

Can bet setup to occur automatically onload. If there is a large menu section that you’d like visitors to scroll past on subpages.

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

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

Occasionally, when working with javascript toggles it becomes necessary to use methods like target=”<?php echo $counter; ?>” in order to build a relationship with other elements involved.

Read More

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

Read More

Working with Custom Post Types can be tricky. Make it easier by using templates to display the taxonomy archive similar to the page.php layout.

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

Read More

Drilling down across multiple post types can help enhance relationships between the content on your website, and direct the flow of traffic on your website.

Read More

This is a great and simple way to keep lists in alpha or numerical order, while splitting up the content to make it easier for the reader to digest.

Read More

This really comes in handy when you’re using specific language on your website for Usernames or need to add in additional fields at signup.

Read More

Sourced here, and also has a great JSFiddle to demonstrate the functionality:

Read More

Many thanks to Rilwis and Charlie Rosenbury for the better-include.php shown below, and sourced here.  I will no doubt, use this several times in the future!

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

A useful addendum to queries when multiple products / post types are going to be featured with the same / similar names. This will prevent the need to add alphanumeric differential identifiers to the titles, and the links, slugs or categories assigned to the content can be used to divide up the information accordingly.

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

Sort Posts by Category

php

February 16, 2016

When generating archive pages, it’s sometimes necessary to return all of the Posts (for a given Post Type), sorted by the Category for visitors to sort through easily.

Read More

You can retrieve the WordPress default image sizes (as well as set custom image sizes) using Advanced Custom Fields using the following:

Read More

Sourced here, this snippet can be inserted within single.php and used to isolate the previous and next navigation links when working with Custom Post Types that have multiple Taxonomies and Terms to allow for more streamlined navigation:

Read More

Use if statement found here that allows you to sort by the parent category, to show only relevant child categories on various landing pages:

Read More

Inherit Featured Image

php

December 10, 2015

If you’d like to continue using the_post_thumbnail in your theme, but do not want to use a fixed default, use this snippet to inherit images from parent pages.

Read More

Change Text on Click

jQuery

December 08, 2015

Toggle text back and forth from a selected phrase using this function

Read More

Here is an embed of the Github code found here:

Read More

Sub-navigation must be in a container

Read More

Handy when listing date / event oriented posts on a feed. Sourced here.

Read More

A recent WooCommerce update broke the shop layout, but wasn’t throwing any errors. Product thumbnails, Prices and Add to Cart buttons all vanished, but were still available on the individual product pages.

Read More

I used this with my Fake Archives for Multiple Authors in order to hide the child containers.

Read More

Generate a list of WordPress posts, grouped by month, for the specified author.

This comes in handy when working with multiple authors, and needing to generate a list of archives for their content.

Read More

Stumbled across this bit of code here. Used to show the main navigation in a sidebar for all child and grandchild pages.

Read More

Alternative: echo wpautop(get_field(‘featured_summary’));

Read More

Single Post as Home Page

php

November 03, 2015

Add the following code to your functions.php in order to redirect your home.php template to the most recent single post

Read More

Add this to functions.php to declare Woocommerce Support in a third party theme:

Read More

Three options as a workaround if a server doesn’t allow for an htaccess file.

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

Adding Counters

php

October 08, 2015

Adding increasing increments to loops can help with styling elements, and revealing additional content. Here are few examples to implement counters with php.

Read More

Working with an older Yahoo! server, I recently ran into the following error when updating WordPress and installed themes / plugins.

Download failed. error:0D0890A1:asn1 encoding routines:func(137):reason(161)

Read More

An alternative to wp_list_categories() – using get_categories() with a loop can prove to be quite useful in terms of customizing category displays.

Read More

Recently came across this request at work, and it seemed impossible to implement without a series of workarounds.

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

Sometimes transitional content is used in one area of a website, like to display hours in a Header or Sidebar. Instead of having the client (or yourself!) update this content every day, get your code to update it for you when the weekdays change.

Read More

Facebook has partnered with McAfee to keep malware, spam, and offensive content off of their social network, and as such, have begun blocking websites and IP addresses that turn up malicious results, or are reported by users.

Read More

Custom Post Types help keep your WordPress backend organized, but figuring out how to get support for plugins can be tricky.

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

Customizing Woocommerce email templates can be tricky if you’re unable to preview the changes that you make, and Woocommerce addons can get pricy.

Read More

Add this to functions.php; update the placeholder “Your Text Here” with your new badge text

Read More

If the BuddyPress plugin Activity Stream is not showing all updates / content that is being published, check if the site is set to Discourage Search Engines under Settings > Reading in the WordPress backend.

Read More

I’ve been using this template as a guide to create HTML newsletters. These can be uploaded to FTP, and hyperlinked on a website, or embedded in an email.

Read More

Mobile Stylesheet

CSS

July 21, 2015

My default mobile stylesheet.

Read More

My starter stylesheet when starting new projects:

Read More

To over-ride WooCommerce templates with your theme default template, copy page.php and rename it to woocommerce.php

Read More

Use this to grab the Featured Image from the post parent if the child page is not using a Feature Image.

Read More

Absolute Positioning

CSS

July 15, 2015

To centre an image inside of a div

Read More

Create a simple background parallax with the following instructions.

Read More

This plugin allows you to sort posts via drag and drop (even custom posts and categories!).

Simply use orderby => menu_order in your loop.

Read More

I have dug all over the internet for a query like this one!

This will generate the get_archives_link needed to link to your Custom Post Type year/month url.

Read More

Drop the below if statement within a loop and add a count for each colour change that you need with the template.

This is a great example to reference if you’re building a scrolling website, and loading all pages in a single progression with alternating templates applied.

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

Get Category by Name

php

June 26, 2015

Retrieve the ID of the first item in a loop:

$category = get_the_category(); 
echo $category[0]->cat_name;
Read More

For use with older browser version testing.

Read More

Create a menu that drills down to subpages as they exist.

Read More

Copy the template files into your theme folder from the plugin file.

These can be edited individually to match whatever layout you desire.

Read More

Design the html email template, like you would a static webpage.  Here is an example of a responsive email template that you can update or use as reference.

Read More

These handy two lines of code can prevent the Plugins submenu from being accessed within WordPress. All users (including Administrators) will no longer have permission to add, edit, or see the update notifications for installed Plugins.

Comes in handy for sites run by Clients that have a lot of plugin customization.

Read More

Create two functions within functions.php. One will control the “if(has)” parameter that will be called within the page template, and one will contain the data that we want to display

Read More

Follow these instructions to exclude custom post type category.

Read More
$top_page_url = get_permalink( end( get_ancestors( get_the_ID(), 'page' ) ) );

Use the above text in place of the_permalink(); in order to retrieve the link information for the topmost page ancestor.

Read More

Download the plugin files from github. Follow directions provided by the plugin author.

Read More

Post Content by ID

php

May 13, 2015

echo apply_filters('the_content', get_post_field('post_content', $post_id));

Sourced here.

Update – July 28, 2015

This method can also be used to retrieve data from custom fields when working with plugins like Advanced Custom Fields:

echo apply_filters('widget_content', get_post_field('widget_content', $post->ID));
Read More

Shopify Product Feed

CMS

May 07, 2015

Create a custom product feed using Liquid within Shopify.

Read More

Simple post feed.

Read More

Blank Shopify Theme

CMS

May 04, 2015

Make re-templating easy by starting with a blank Shopify theme instead of restyling an existing one.

Blankify is a stripped-bare Shopify template that makes developing in Shopify much simpler.

Use this Cheat Sheet while developing to get things done quickly.

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

If you’re experiencing issues with page/post content not loading, even though the link displays in the URL; check your Trash bin for an item with a similar permalink.

This will often prevent permalinks from working properly.

Read More

If you’re ever locked out of your site backend and need the WordPress version to perform an update, you can echo it via FTP using this code:

echo $wp_version;

 

Read More
<ul>
  <?php $n = 0; foreach($page->children() as $child): $n++; ?>
  <li class="<?php echo ($n%2) ? 'odd' : 'even' ?>">
    ...
  </li>
  <?php endforeach ?>
</ul>

You can change “odd” and “even” to whatever names you need.  Sourced here.

Read More

Once I was greeted with an “Error establishing a Database Connection” message, despite nothing being changed on the website (ftp, cpanel, etc) in several months.

Read More

Woocommerce Tax Setup

Plugins

February 26, 2015

When enabling multiple tax amounts in Woocommerce, ensure that you change the priority of each Tax Amount entered, in order to make sure the taxes will render separately at checkout!Screen shot 2015-02-26 at 12.09.49 PM

Read More

Target cc Field with HTML

HTML

February 25, 2015

Targeting the mailto field is pretty rudimentary, but you can keep yourself organized if you use such items like the cc-field, and the subject line in order to keep track of where your visitors are when they contact you.

Read More

In version 4.1 I recently encountered an update (version and plugin) error where the installer was unable to locate the wp-content directory to complete the update.

Read More

Add Excerpt to Pages

WordPress

February 24, 2015

Sometimes it’s handy to utilize the same features that are available within the Posts area, inside of your Pages. Adding the Excerpt to the Pages, provides you with an additional, native field to pull data from and take advantage of when building your WordPress website.

Read More

Using large sliding banners with linked content can be both a blessing and a curse.  This adds a beautiful level of style and information to the site, but also takes up a lot of space, and provides a lot of repetitive information that can be difficult for new visitors to navigate.

Read More

Target Mobile Devices

jQuery

January 22, 2015

Comes in handy when working with older devices.

Read More

I recently needed to create a dynamic table for a visual aesthetic. A few background images had been strategically placed alongside the content, and the grid provided structure and flow.  Using this bit of code, I was able to target a div to populate an empty table, and style it accordingly.

Read More

Sometimes you don’t want your clients to know that updates are needed. When Woocommerce is paired with powerhouse plugins like WPML, older versions can be difficult to update, and you should tread lightly: with backups.

Read More

IE7 Filter and Overflow

Browsers

December 22, 2014

Overflow: visible will not work in combination with Filters in IE7.  These will need to be deactivated, or back-hacked.

Read More

Embedded fonts that are being loaded from a server / another website, or file, will sometimes load after the main css file, and after the page is loaded, resulting in a weird display. Typekit fonts can be loaded faster using a timeout script.

Read More

Auto-Updating Copyright Year

php

December 02, 2014

Using the_date(); this is very easy to achieve, all you need is  &copy; to get yourself setup. To take it a step further, you can include a date span, so your clients are aware of just how long you’ve been burning the midnight oil.

<p>&copy; 2013 <?php date('Y') == "2012" ? $year = "" : $year = "- ".date('Y'); echo $year; ?></p>

Sourced here.

Read More

Login Re-Direct?!

WordPress

November 24, 2014

WordPress keep redirecting me to the login page, even though I’ve entered my username and password correctly, several times. Check the address bar for this information after wp-login:

?redirect_to=http%3A%2F%2Fyourdomainname.ca%2Fmbprospects%2Fwp-admin%2F&reauth=1

Remove it, and press enter. You will still be at the login screen, and yes, will have to login again, but there will no longer be a redirect loop taking place.

Read More

When Themes are upgraded in Shopify, script libraries are upgraded. Depending on the level of expertise of the individual that developed your Theme, this means errors can arise. If your mobile navigation stops working, you may need to find your scripts.js.liquid file and look for errors in syntax and coding. Check your console to be sure which file you should edit, and always make a back up!

Read More

Read this article about enabling Mandrill on  your site with

Read More

If you’ve ever encountered this error while using NextScripts SNAP, you know that’s it’s not very simple to resolve:

Read More

Place this within the single.php template to grab the Featured Image and format it automatically inline with the content.

the_post_thumbnail('large', array('class' => 'alignright'));

This can also be used in the loop with alongside posts with featured images.

Read More

Ever been hacked or had a change of staff and completely lose access to the website you’ve put so much time and effort into? The following code goes a long way, if you drop this into your sql through phpMyAdmin, this will create an Administrator account, granting you access to your website once again. Simply update the fields to the name of your database, and the username you would like to use to access the site. Voila!

Read More

List Child Pages

php

September 30, 2014

When using Slick on Android, you may find that the vertical scrolling, or site progression, becomes inaccessible if you have a full-width slider.

Read More

Customize the output to match your theme.

Read More
the_post_thumbnail('medium', array('class' => 'alignright'));

 

Read More

Sometimes fixing iframe and YouTube embed issues can be as simple as adding wmode=transparent to the iframe src string <iframe scr”http://youtube.com/embed/link_to_video” wmode=”transparent”></iframe> Other times, you may need to change this to wmode=”Opaque” If you’re still experiencing issues with drop down menus appearing behind iframes, and z-index is being ignored, the following code will come in handy.  

Read More

IFrames can be difficult to customize.  If you want to add a border, or a box shadow to them, it can be simpler to do so if you wrap them in a parent div, and apply the necessary changes to this container.  Border-radius will work with a parent div, when you couple it with overflow: hidden; forcing the clipping of the contained elements, and giving the illusion of the effect you’re looking for.

Read More

This function, when added to functions.php, will help you add a posts_per_page query to the archive.php and archives.php pages, enabling you to further customize the output. Sourced from here

Read More

It helps in the long run to install WordPress in a sub folder, this will keep multiple domains / folders better organized in your ftp.

Read More

Thematic Archives.php

WordPress

September 11, 2014

The Archives.php and Archive.php templates are setup to pull in certain data within their loops, and these can be difficult to adjust. I found the below template for Thematic here and have used this to style main and monthly archive feeds in the past.

Read More

Menus can be tricky. Rather than being locked into the just using menu sort order, or alphabetical order, combine the two using wp_list_pages(); You can style the drop downs to respond on hover using CSS.

Read More

Adjust Div Size with jQuery

jQuery

September 04, 2014

When working with background images, parallax websites, or full width and height sliders, you might find the need to have a div adjust to be the full width or height of the viewport automagically. This code will help you find your way. Sourced from the comments on css-tricks.com

Read More

Often, the WordPress Plugin Multiple Post Thumbnails is used within the page.php and single.php templates, and few conflicts arise. If you’re calling your thumbnails within header.php, footer.php or functions.php, the following code will help sort out issues with images not displaying via the simpler methods.

Read More

This is a handy trick if you’re working with ajax or dynamic elements that are using a filter, such as Ultimate WordPress Query Search Filter.

Read More

Working with Shopify, I found this bit of code, and was able to setup auto-switching full screen background images. You can use this to setup multiple background images that will change over automagically on page load.

Read More
global $post; 
$slug = get_post( $post )->post_name;

See reference on WordPress support forums here.

Read More

A handy WordPress function to allow you to filter by child pages for great functionality.  Please see reference and author here. Function and simple example usage. Please see website of Kevin Leary for greater functionality and more complex usage.

Read More

Place this code inside of the relevant Div

Read More

I’ve run into problems several times where exclude and include do not work, or work selectively, and as a result, either all of the posts are included, or none of them are. I’ve found an answer that works both inside and outside of the loop.

Read More

Background-Attachment: Fixed does not work in Safari when using multiple background images in Safari.  The images will disappear when the browser is resized, or accessed in mobile device.  Background-Attachment: Fixed will render the images properly in Chrome, and Firefox, but even when coupled with Display: Block, and Overflow: Hidden to force images to appear, will not work properly in Safari.

Read More

Add this code to your functions.php file in order to create Breadcrumbs.

Read More

Add suppress_filters => 0 to your get_posts(); argument and everything will be just fine!!!

Read More

Use this function at add a class to the <body> for the active language:

function wpml_lang_body_class($classes) { 
     $classes[] = ICL_LANGUAGE_CODE; return $classes; 
} 
add_filter('body_class','wpml_lang_body_class');
Read More

No problem!

The Photoshop Scratch Disk is your hard drive where Photoshop is installed. Photoshop uses your hard drive as temporary “swap” space, or virtual memory, when your system does not have enough RAM to perform an operation. This can become “full” if Photoshop crashes and/or several temporary files have been created by Photoshop and not cleared out properly.

Read More