A collection of (mostly) WordPress-related snippets and references I’ve found useful and worth keeping where I can find them. Feel free to use what you like, and point me to some better snippets or references.
Add a custom WP_Query to a Divi page»
Recently, I designed a site using Divi because that’s what the client is used to. They didn’t have a lot of technical requirements, so I figured Divi would be OK.…
Add attributes to WordPress Nav Menu Links (a tag)»
This can be very useful if you need to add attributes for a menu script. /** * Add custom attribute and value to a nav menu item's anchor based on…
Nav Menu, WP/CP | Type: PHP
Add Columns to Admin CPT Listing»
See David Lord site for implementation.
ACF, CPT, Custom Admin | Type: PHP
Add Contextual Help for Custom Post Types»
The contextual help feature is a descending tab which can be seen in the top right of pages where available.
Custom Admin, Users, WP/CP | Type: PHP
Add EDD Cart Info Anywhere»
Allows you to add cart info in header, sidebar, etc.
eCommerce | Type: Other
Add Message on Thumbnail Metabox»
Sometimes you need to change the message.
Custom Admin, Users, WP/CP | Type: PHP
Add search form to specific nav menu»
add_filter('wp_nav_menu_items', 'add_search_form', 10, 2); function add_search_form($items, $args) { if( $args->theme_location == 'MENU-NAME' ) $items .= '<li class="search"><form role="search" method="get" id="searchform" action="'.home_url( '/' ).'"><input type="text" value="search" name="s" id="s" /><input type="submit" id="searchsubmit"…
Nav Menu, Search | Type: PHP
Add Theme Support for Title Tag»
It used to be that the way to add the Title Tag to WP sites was to add this in the theme’s header.php: <title><?php wp_title(); ?></title> Since WP4.1, use this…
Template Tags, WP/CP | Type: PHP
Adding an edit tag in PHP conditional»
Add [EDIT] in a PHP conditional, with style tags surrounding
PHP, WP/CP | Type: PHP
Adjust widget tag cloud font size range»
Sometimes the tag cloud sizes are too extreme. This fixes that.
WP/CP | Type: PHP