Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Setting up block elements to display on selected pages with GeneratePress, Generate Blocks and ACF

  • Dan Media Design
  • 2021-01-29
  • 694
Setting up block elements to display on selected pages with GeneratePress, Generate Blocks and ACF
GeneratePressGenerateBlockACF
  • ok logo

Скачать Setting up block elements to display on selected pages with GeneratePress, Generate Blocks and ACF бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Setting up block elements to display on selected pages with GeneratePress, Generate Blocks and ACF или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Setting up block elements to display on selected pages with GeneratePress, Generate Blocks and ACF бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Setting up block elements to display on selected pages with GeneratePress, Generate Blocks and ACF

Setting up block elements to display on selected pages

We will create a predefined block area that we can decide where to display based on an ACF (Advanced Custom Field) checkbox to show or hide that area.
We will be using the new block hook element that comes with GeneratePress, an ACF field and a little filter.

Create the Block hook element and set it to show “generate_before_footer” - that is where we would like to show the carousel. Leave all other fields unchanged. We will take care of the display with our filter.

Create an ACF - “Show Product Carousel” which will be a True/False field. We will show the True/False toggle on the pages and posts:

Create the “Generate Block Element Display” filter which will take care of displaying our block element if we have also turned on our ACF checkbox

add_filter( 'generate_block_element_display', function( $display, $element_id ) {
//var_dump( $element_id );
//var_dump(get_field( 'show_product_carousel' ));
if ( 7314 === $element_id && get_field( 'show_product_carousel' ) ) {

$display = true;
}
return $display;
}, 10, 2 );

In the code above 7314 is the elements ID and show_product_carousel is the ACF field. The function checks if the element exists AND if the ACF exists, only then it displays it in the location we set in item 1- ‘generate_before_footer’

This allows us to create a very useful template to use across pages and centrally managed in the Elements editor. So if we would like to change the carousel or even add another block, we can do it once and it will reflect on all places where it’s shown.
This is a first step of creating managed block templates and then integrating them based on a page template or ACF field. Which will allow easy management and design of site pages.

Have any other ideas of implementing block hooks and ACF? I would like to know.

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]