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
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
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 MoreWorks with Gutenberg.
Read MoreThis affects all post types. Wrap in conditions to reduce appearance. Featured Image column will appear last.
Read MoreHelp 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 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 MoreHow to remove the UL and Div containers on the wp_nav_menu() function.
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 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
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 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 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 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 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 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 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 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 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 MoreWorks in relationship with has_children();
Read MoreWorking within different loops different ways has it advantages …
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 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 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 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 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 MoreBelow 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 MoreAdd 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 MoreComes 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 MoreI’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 MoreWorking on heavily cached servers with limited access to cPanel / server resources makes it difficult to apply website updates in a timely fashion.
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 MoreIf 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 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 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 MoreCreate a custom Date Archive using the following snippet.
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 MoreHtaccess file of compiled sources to block referrer spam and bad bots. Updated regularly, various sources.
Read MoreThe default markup for previous_post_link and next_post_link can be difficult to style and adjust using CSS alone.
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 MoreIncredibly 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 MoreUpdating your Reading Settings within WordPress affects all templates of your site:
Read MoreI 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 MoreRe-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 MoreBy 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 MoreGreat way to hide categories from the front end if they are reserved for a different purpose:
Read MoreDetect if a product is in the cart and add it by product ID as soon as a visitor is on your website.
Read MoreError 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 MoreAdjust the supports array of your Custom Post Type within functions.php to enable Menu Order filtering by adding ‘page-attributes’:
Read MoreFound a handy function over at WP Beginner that allows you to hide the Toolbar for anyone that does not have Administrator access.
Read MoreThis 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 MoreBased 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 MoreWordPress does not natively support uploads for ePub files. To enable this support, add the following to functions.php
Read MoreFollow these steps when placing WordPress in a subfolder.
Read MoreCustomize your theme further by enabling the ability to show the caption when using the Featured Image.
Read MoreAdding dynamic slugs to your body class can help enhance the ability to style your theme.
Read MoreIf 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 MoreWorking with large sites that have cross-over content, sometimes it’s necessary to know how to bring multiple taxonomies into a single query.
Read MoreThis attribute needs to be fed an array, even if a single item is being called, or it will not function properly
Read More