ACF Fields added to the template outside of the_content() will have this problem.
Read MoreCustomizing 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 MoreCommon 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
Setup a stylesheet for the default login screen, and update the heading url.
Read MoreMembership 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 MoreThis will search Posts and Post Types for Taxonomies that match the search terms and will return the Posts (not the taxonomies).
Read MoreHandy 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 MoreUseful to add custom styles or punctuation to last item in an array.
Read MoreThis affects all post types. Wrap in conditions to reduce appearance. Featured Image column will appear last.
Read MoreUse to convert text with spaces into lowercase data with dashes so it can be used for element tags.
Read MoreWorked on a subscription service website recently that had specific weekly cutoffs for ordering in order to have ordering available for the following week.
Read MoreCheck if the current term is a parent and allow for different formatting based on conditions.
Read MoreTwo 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 MorePlace this in functions in order to create your own custom block styles and render them in the editor.
Read MoreWorking 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 MoreIn 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 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 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 MoreI use Page Links To a lot. Probably on every website I’ve built for the last five years.
Read MoreHandy snippet for updating the default title text on a Comment Form.
Read MoreI used this on a custom page template showing only Past Events.
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 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 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 MorePlace the below in your functions.php to add your own custom font options to the core Paragraph Block.
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 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 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
I 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 MoreGreat to use on product pages to reveal varied standardized text from the template when Products use shared terms like colours, or sizes.
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 MoreWorks in relationship with has_children();
Read MoreI have used counting classes so many times, but never understood them to this extend until I found this example.
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 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 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 MoreAdjust your post feed according to which Posts are using Read More tags.
Read MoreI 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 MoreI’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 MoreTurn your Gravity Form into a booking calculator!
Read MoreIf 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 MoreUse the following function to determine if the current page you are on has any child pages.
Read MoreWordPress 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 MoreWorking on heavily cached servers with limited access to cPanel / server resources makes it difficult to apply website updates in a timely fashion.
Read MoreA 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 MoreIf 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 MoreOn 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 MoreBuilding 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 MoreEnable background and text colour changes within your template using Advanced Custom fields.
Read MoreI 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 MoreIf 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 MoreI 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 MoreUse with Link to Top-most Page in Hierarchy for a more dynamic nested sub-navigation menu.
Read MoreChange the default number of words returned by the_excerpt() using this function:
Read MoreA 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 MoreMore 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 MoreSetup page titles for different page levels using the following statement. Below example is using the Thematic WordPress Theme.
Read MoreThe 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 MoreSimilar to my Subnavigation Function, this will display widgets and adjust column widths if widgets are active on the page.
Read MoreThis 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 MoreTemplate 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 MoreThe 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 MoreSometimes 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 MoreYou 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 MoreCreating 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 MoreGreat way to hide categories from the front end if they are reserved for a different purpose:
Read MoreSometimes 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 MoreFound this demonstrative function in the wp_get_current_user(); WordPress documentation, as a way to test if a user is logged in
Read MoreUseful way to grab the title from the page ancestor, and setup child page titles.
Read MoreThis example will allow for a class to be added to the current child page so it can be custom styled.
Read MoreBased off of this WordPress codex reference function
Read MoreAdd 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