
內容簡介
這個外掛可以為 WordPress 的編輯器新增靈活的 Bootstrap 4 區塊,讓您可以使用 Bootstrap 樣式網格來建立自訂頁面版型。
您正在使用 Advanced Bootstrap Blocks 嗎?請撰寫評論!
區塊
Advanced Bootstrap Blocks 為 WordPress 編輯器新增了以下 Bootstrap 4 區塊:
容器 (固定寬度或流動式,具有背景圖像設定)
列
欄
按鈕及按鈕群組
帶有標題、主體與頁腳的卡片
Jumbotron
區塊範本
您是否需要建立 WordPress 頁面和文章的標準區塊版型?WordPress 編輯器允許您在佈景主題中定義自訂區塊範本。
以下範例可能可以幫您開始。前往WordPress 區塊編輯器手冊以了解更多關於增強 WordPress 主題的區塊範本的資訊。
<?php
if(in_array('advanced-bootstrap-blocks/advanced-bootstrap-blocks.php', apply_filters('active_plugins', get_option('active_plugins')))){
// 這裡的內容僅在 Advanced Bootstrap Blocks 外掛啟用時顯示
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.', ],
[]
],
]
]
]
]
]
],
];
}
}
外掛標籤
開發者團隊
原文外掛簡介
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.
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.', ],
[]
],
]
]
]
]
]
],
];
}
}
