Skip to content

Releases: lipemat/wordpress-libs

CMB2 True False

18 Dec 19:25
Compare
Choose a tag to compare

Introducing a True/False field type for CMB2

Similar to the field you can find in ACF. Works just like a checkbox, but with a clean on/off switch UI.

$box->field( 'switch-field', "I'm a switch!" )
	 ->true_false();

CMB2 Number Field

18 Dec 17:00
Compare
Choose a tag to compare

Text Number Field Support For CMB2

When using the Field object to register CMB2 a new method called text_number creates a number input with support for specifying step, min, and max.

$box->field( 'a-number-field', 'Number Field' )
	->text_number( 1, 50, 2000 );

Gutenberg Support For Custom_Post_Type

17 Dec 20:53
Compare
Choose a tag to compare

Enable or disable the block editor via a class property

Set the property and all requirements and/or filters will be taken care of automatically.

$post = new Custom_Post_Type_Extended( 'products' );
$post->gutenberg_compatible = false;

CMB2 Box Descriptions

12 Dec 21:11
Compare
Choose a tag to compare

CMB2 support for displaying a description above an options-page or a metabox

$box = new Box( self::NAME, $object_types, 'Ad Data' );
$box->description( 'test description' );

Gutenberg Ready

06 Dec 21:45
Compare
Choose a tag to compare

WordPress 5.0 was Finally release today with support for Gutenberg. This release contains all the latest notes and enhancements available with WordPress 5.0

While the last version of this library works without issue with WordPress 5.0, to have all the latest enhancements you can update.

Some Enhancements

  1. Support Gutenberg properties via display_when_gutenberg_active and gutenberg_compatible within the Schema/Meta_Box class.
  2. Support Gutenberg properties via display_when_gutenberg_active and gutenberg_compatible within the CMB2/Box class.
  3. Add tab_group property to the CMB2/Options_Page class.
  4. Add new register_post_type labels to the Post_Type/Custom_Post_Type class.
  5. Make notes about show_in_rest requirements.

Thanks For The Memories - Filter Closures

28 Nov 22:29
Compare
Choose a tag to compare

This version adds a nice new method to the Util/Actions class called 'add_filter_as_action()'

Solves a long tedium when you need to hook into an apply_filters() call without actually filtering anything. When you just wish you had a do_action() there instead of an apply_filters().

Observe

Old Way

add_filter( 'some_conviently_placed_filter', function( $value ) {
      custom_function_call();
      return $value;
});

New Way

Actions::in()->add_filter_as_action( 'some_conviently_placed_filter', 'custom_function_call' );

CMB2 Compact Checkboxes

16 Nov 19:01
Compare
Choose a tag to compare

CMB2 compact layout for checkboxes. Useful for side meta boxes that get very long using the default layout.

// shorthand
$box->field( self::FIELD_ID, 'Compact Checkbox' )
			->checkbox( 'compact' )

CMB2 Group Layouts

15 Nov 13:16
Compare
Choose a tag to compare

CMB2 Group layouts allow displaying a CMB2 group in either a row or table layout. Displays group items in a more compact and pleasing UI.

// shorthand
$group = $box->group( self::GROUP_ID, 'Table GROUP' )
			->layout( 'table' );

Other Enhancements

  • Support using keyed and flat arrays at the same time with Class_Names
  • Support LIKE queries in Schema\Db
  • Support '' queries in Schema\Db

Single Fire Actions

31 May 07:43
Compare
Choose a tag to compare

New methods added to the Util/Actions class for firing an action or filter one time. Useful in situations where do_action() or apply_filters() fires more than once during a call, page-load, or user action.

use Lipe\Lib\Util\Actions;
Actions::in()->add_single_filter( $filter, $callable, $priority = 10, $accepted_args = 1 );
Actions::in()->add_single_action( $action, $callable, $priority = 10, $accepted_args = 1 );

Improving Available Services

02 May 17:59
Compare
Choose a tag to compare

Introducing a new Zip service for generating cached .zip files. It accepts an array of file URLS and a name for the .zip file. When complete, it serves the zip to the browser. Can also be used as an api endpoint when sending a validation key.

use Lipe\Lib\Util\Zip;
Zip::in()->build_zip( [ $url, $url ], $zip_name );

Introducing a new class for adding public query vars or the deprecated filter param to wp-json requests. Simply init the class and the rest happens automatically for all existing post types with the rest api enabled.

use Lipe\Lib\Rest_Api\Query_Vars;
Query_Vars::init();

Greatly improved the Db Schema.