Advanced Bootstrap Blocks

Mô tả

This plugin adds flexible Bootstrap 4 blocks to the WordPress editor for creating custom page layouts with the Bootstrap grid.

Are you using Advanced Bootstrap Blocks? Write a review!

Blocks

Advanced Bootstrap Blocks adds the following Bootstrap 4 blocks to the WordPress editor:

  • Container (fixed-width or fluid, with background image settings)
  • Row
  • Column
  • Button and Button Group
  • Card with Header, Body, Footer
  • Jumbotron

Block Templates

Do you need to create standard block layouts for WordPress pages and posts? The WordPress editor lets you define custom block templates inside your theme.

The example below may get you started. Visit the WordpPress Block Editor Handbook to learn more about supercharging your WordPress themes with blocks templates.

<?php
if(in_array('advanced-bootstrap-blocks/advanced-bootstrap-blocks.php', apply_filters('active_plugins', get_option('active_plugins')))){ 
    // do stuff only if the Advanced Bootstrap Blocks plugin is active              
    add_action( 'init', 'advancedbootstrapblocks_register_page_template' );
    function advancedbootstrapblocks_register_page_template() {
        $post_type_object = get_post_type_object( 'page' );
        $isFluid = get_theme_mod( 'understrap_container_type' ) === 'container-fluid'; 
        $post_type_object->template = [
            [ 'advanced-bootstrap-blocks/container', 
                ['className'=>'py-5', 'isWrapped' => $isFluid, 'isFluid' => false ], 
                [
                    [ 'advanced-bootstrap-blocks/row', 
                        [],
                        [
                            [ 'advanced-bootstrap-blocks/column', 
                                ['className'=>'col-md-8 offset-md-2 text-center'], 
                                [
                                    ['core/heading', 
                                        [ 'className' => 'display-4', 'level' => 1, 'placeholder' => 'Hello, World!', ], 
                                        []
                                ],
                                    [ 'core/paragraph', 
                                        ['className' => 'lead', 'placeholder' => 'Lorem ipsum dolor sit amet.', ], 
                                        []
                                    ],
                                ]
                            ]
                        ]
                    ]
                ]
            ],
        ];
    }
}
Rate this post

Hãy bình luận đầu tiên

Để lại một phản hồi

Thư điện tử của bạn sẽ không được hiện thị công khai.


*