Skip to content

Releases: lipemat/wordpress-libs

Cron Abstract

20 Dec 13:52
Compare
Choose a tag to compare

Registering Crons Via New Abstract

use Lipe\Lib\Cron\Cron_Abstract;

class Daily_Report extends Cron_Abstract {
	public const NAME = 'cron/daily-report';

	public function get_recurrence() : string {
		return 'daily';
	}


	public function run() : void {
		/**
		 * This could send an email
		 * or update field, or anything a cron can do.
		 *
		 */
	}
}

Disabled And Readonly

19 Dec 17:45
Compare
Choose a tag to compare

Enhancements around disabled and readonly fields

  1. New readonly method on CMB2\Field which makes a field as readonly as well as marking fields disabled of types that can only be disabled to be readonly.
  2. New save_button method on CMB2\Options_Page which supports disabling the save button for a readonly settings page.

A few other misc enhancements

  1. New remove_box_wrap method for CMB2\Box.
  2. Improved True_False field markup.
  3. Improved CMB2\Field::attributes() method to merge in attributes instead of squashing existing.

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