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 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
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
Animate as Item Enters Viewport»
Nice piece of work from Chris Coyier.
Animation, CSS3, Javascript, jQuery | Type: Javascript
Animate on Scroll»
Animates block items as you scroll and they enter the viewport.
Animation, CSS3, Javascript | Type: Javascript