kunoichi/bootstrapress

UI wrapper of Bootstrap for WordPress.

1.0.2 2022-12-02 05:09 UTC

This package is auto-updated.

Last update: 2024-11-30 01:47:58 UTC


README

UI wrapper of Bootstrap for WordPress.

Installation

composer require kunoichi/bootstrapress

And in your functions.php, require vendor/autoload.php.

// functions.php
require __DIR__ . '/vendor/autoload.php';

Now you are ready!

How To Use

It simply wraps Bootstrap UI to WordPress one.

Navbar

Convert WordPress menu's HTML to suit with Bootstrap navbar.

// Pass $theme_location of your menu.
// It will be output as navbar.
new \Kunoichi\BootstraPress\NavbarMenu( 'header-menu' );

Pagination

Output Bootstrap style pagination for archive page. Wrapping it in your function because of future updates.

/**
 * Output pagination for archive page.
 */
function your_theme_pagination() {
    \Kunoichi\BootstraPress\PageNavi::pagination();
}

Navpages

Output links for paginated posts in Bootstrap style. Uses wp_link_pages internally. Wrapping it in your function because of future updates.

/**
 * Output pagination for archive page.
 */
function your_theme_link_pages() {
    \Kunoichi\BootstraPress\PageNavi::pagination();
}

Color Extractor

You can extract colors for Gutenberg color panel.

/**
 * Register colors.
 */
add_action( 'after_setup_theme', function() {
	if ( ! class_exists( 'Kunoichi\BootstraPress\Css\Extractor' ) ) {
		return;
	}
	$extractor = new Kunoichi\BootstraPress\Css\Extractor( get_template_directory() . '/style.css' );
	$pallets = $extractor->get_color_palette();
	if ( ! $pallets ) {
		return;
	}
	$colors = [];
	foreach ( $pallets as $slug => $color ) {
		$colors[] = [
			'name'  => ucfirst( $slug ), // For i18n, consider translation function.
			'slug'  => $slug,
			'color' => $color,
		];
	}
	add_theme_support( 'editor-color-palette', $colors );
} );

License

GPL 3.0 and later. Compatible with WordPress.