Download the PHP package builtnorth/wp-utility without Composer
On this page you can find all versions of the php package builtnorth/wp-utility. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download builtnorth/wp-utility
More information about builtnorth/wp-utility
Files in builtnorth/wp-utility
Package wp-utility
Short Description Utility functions and helpers for WordPress development
License GPL-2.0-or-later
Informations about the package wp-utility
WP Utility
A comprehensive WordPress utility library providing reusable components, helpers, and utilities for modern WordPress development.
Requirements
- PHP >= 8.1
- WordPress >= 6.4
Installation
Install via Composer:
Basic Setup
In your plugin or theme, initialize WP Utility:
Components
Components provide reusable UI elements with consistent APIs.
AccessibleCard
Creates accessible card components with proper ARIA attributes:
Breadcrumbs
Generates semantic breadcrumb navigation:
Filters:
wp_utility_breadcrumb_open_nav- Customize opening navigation HTMLwp_utility_breadcrumb_close_nav- Customize closing navigation HTMLwp_utility_breadcrumb_item- Customize individual breadcrumb itemswp_utility_breadcrumb_separator- Customize separator HTML
Button
Renders flexible button or link elements:
Filters:
wp_utility_button_block_prefix- Customize button class prefixwp_utility_button_screen_reader_text- Filter resolved screen reader textwp_utility_button_generic_link_labels- Generic labels that receive post-title context in loops
Screen reader text:
Image
Advanced image rendering with responsive sizes:
Pagination
Generates accessible pagination for WordPress queries:
Filters:
wp_utility_pagination_args- Modify pagination argumentswp_utility_pagination_wrapper- Customize wrapper attributes
Utilities
Utilities provide data processing and retrieval functions.
ArchiveUrl
Handles conversion of pretty permalinks to query string URLs for archive pages:
CountryList
Returns an array of countries with ISO codes:
GetTerms
Renders terms for a post:
GetTitle
Retrieves appropriate page title across different WordPress contexts:
LazyLoadFirstBlock
Controls lazy loading behavior for blocks:
Filter:
wp_utility_lazy_load_non_lazy_parents- Modify non-lazy parent blocks
ReadingTime
Calculates estimated reading time:
Filter:
wp_utility_reading_time_wpm- Customize words per minute (default: 200)
StateList
Returns an array of US states:
Helpers
Helpers provide utility functions for common tasks.
EscapeSvg
Safely escapes SVG content for output:
Setup
Setup classes handle WordPress configuration and initialization.
ImageSetup
Configures custom image sizes and removes WordPress defaults.
Manual Initialization
Default Image Sizes
-
Wide formats:
wide_xlarge: 1600px widewide_large: 1200px widewide_medium: 800px widewide_small: 600px widewide_xsmall: 300px wide
- Square formats (cropped):
square_xlarge: 1200x1200square_large: 800x800square_medium: 600x600square_small: 300x300square_xsmall: 150x150
Filters
wp_utility_image_sizes- Customize image sizes arraywp_utility_image_size_names- Customize display nameswp_utility_remove_default_sizes- Control which default sizes to removewp_utility_max_srcset_width- Set maximum srcset width (default: 1600)
Example: Custom Image Sizes
Method Naming Conventions
All components, utilities, and helpers support multiple naming conventions:
Backward Compatibility
The library maintains backward compatibility through class aliases:
BuiltNorth\WPUtility\Component→BuiltNorth\WPUtility\Components\ComponentBuiltNorth\WPUtility\Utility→BuiltNorth\WPUtility\Utilities\UtilityBuiltNorth\WPUtility\Helper→BuiltNorth\WPUtility\Helpers\HelperBuiltNorth\WPUtility\Utilities\ImageSetup→BuiltNorth\WPUtility\Setup\ImageSetup
Testing
Run the test suite:
Contributing
See CONTRIBUTING.md for details on how to contribute to this project.
License
This package is licensed under the GPL version 2 or later. See LICENSE.md for details.
Disclaimer
This software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
Use of this library is at your own risk. The authors and contributors of this project are not responsible for any damage to your website or any loss of data that may result from the use of this library.
While we strive to keep this library up-to-date and secure, we make no guarantees about its performance, reliability, or suitability for any particular purpose. Users are advised to thoroughly test the library in a safe environment before deploying it to a live site.
By using this library, you acknowledge that you have read this disclaimer and agree to its terms.