File: D:/HostingSpaces/MDalebout3/dev.prdct.nl/wwwroot/wp-content/themes/theme/blocks/blocks.php
<?php
add_action('acf/init', 'my_acf_init_block_types');
function my_acf_init_block_types() {
// Check function exists.
if( function_exists('acf_register_block_type') ) {
// register a sublogo block.
acf_register_block_type(array(
'name' => 'block-left-top-sublogo',
'title' => __('Sublogo'),
'description' => __('Sublogo block'),
'render_template' => 'blocks/block-left-top-sublogo.php',
'category' => 'formatting',
'icon' => 'art',
'keywords' => array( 'sublogo', 'svg' ),
'example' => ['attributes' => ['mode' => 'preview', 'data' => []]],
'mode' => 'edit',
));
// register a top block block.
acf_register_block_type(array(
'name' => 'block-top-title',
'title' => __('Top title block'),
'description' => __('Top title'),
'render_template' => 'blocks/block-top-title.php',
'category' => 'formatting',
'icon' => 'text',
'keywords' => array( 'title', 'description' ),
'example' => [],
'mode' => 'edit',
));
// register a central image block.
acf_register_block_type(array(
'name' => 'block-central-image',
'title' => __('Central Image'),
'description' => __('Central Image'),
'render_template' => 'blocks/block-central-image.php',
'category' => 'formatting',
'icon' => 'format-image',
'keywords' => array( 'image', 'center' ),
'example' => ['attributes' => ['mode' => 'preview', 'data' => [
'central_image' => '/wp-content/uploads/2020/09/central_image.png'
]]],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-content-link',
'title' => __('Content Block'),
'description' => __('Content Block'),
'render_template' => 'blocks/block-content-link.php',
'category' => 'formatting',
'icon' => 'vault',
'keywords' => array( 'title', 'description' ),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-two-col',
'title' => __('Two column Block'),
'description' => __('Two column Block'),
'render_template' => 'blocks/block-two-col.php',
'category' => 'formatting',
'icon' => 'columns',
'keywords' => array( 'two', 'column' ),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-tools',
'title' => __('Tools Block'),
'description' => __('Tools Block'),
'render_template' => 'blocks/block-tools.php',
'category' => 'formatting',
'icon' => 'hammer',
'keywords' => array( 'tools'),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-clients',
'title' => __('Clients Block'),
'description' => __('Clients Block'),
'render_template' => 'blocks/block-clients.php',
'category' => 'formatting',
'icon' => 'admin-users',
'keywords' => array( 'tools'),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-slider',
'title' => __('Slider Block'),
'description' => __('Slider Block'),
'render_template' => 'blocks/block-slider.php',
'category' => 'formatting',
'icon' => 'format-gallery',
'keywords' => array( 'gallery'),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-quote',
'title' => __('Quote Block'),
'description' => __('Quote Block'),
'render_template' => 'blocks/block-quote.php',
'category' => 'formatting',
'icon' => 'format-quote',
'keywords' => array( 'quote'),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-articles',
'title' => __('Posts Block'),
'description' => __('Posts Block'),
'render_template' => 'blocks/block-articles-slider.php',
'category' => 'formatting',
'icon' => 'embed-post',
'keywords' => array( 'posts', 'articles', 'slider'),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-newsletter',
'title' => __('Newsletter Subscribe Block'),
'description' => __('Newsletter Subscribe Block'),
'render_template' => 'blocks/block-newsletter.php',
'category' => 'formatting',
'icon' => 'email-alt2',
'keywords' => array( 'email' , 'newsletter'),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-text-logos',
'title' => __('Texts and logos Block'),
'description' => __('Texts and logos Block'),
'render_template' => 'blocks/block-text-logos.php',
'category' => 'formatting',
'icon' => 'media-spreadsheet',
'keywords' => array( 'logos' , 'text'),
'example' => [],
'mode' => 'edit',
));
acf_register_block_type(array(
'name' => 'block-single-content',
'title' => __('Single Content block'),
'description' => __('Single Content block'),
'render_template' => 'blocks/block-single-content.php',
'category' => 'formatting',
'icon' => 'format-aside',
'keywords' => array( 'content' , 'single'),
'example' => [],
'mode' => 'edit',
));
//Facts & Figures Block
acf_register_block_type(array(
'name' => 'block-facts-figures',
'title' => __('Facts & Figures Block'),
'description' => __('Facts & Figures Block'),
'render_template' => 'blocks/block-facts-figures.php',
'category' => 'formatting',
'icon' => 'editor-ol',
'keywords' => array( 'facts' , 'figures'),
'example' => [],
'mode' => 'edit',
));
//Our people Block
acf_register_block_type(array(
'name' => 'block-our-people',
'title' => __('Our People Block'),
'description' => __('Our People Block'),
'render_template' => 'blocks/block-our-people.php',
'category' => 'formatting',
'icon' => 'groups',
'keywords' => array( 'our' , 'people'),
'example' => [],
'mode' => 'edit',
));
//Vacatures Block
acf_register_block_type(array(
'name' => 'block-vacatures',
'title' => __('Vacatures Block'),
'description' => __('Vacatures Block'),
'render_template' => 'blocks/block-vacatures.php',
'category' => 'formatting',
'icon' => 'businessperson',
'keywords' => array( 'vacatures'),
'example' => [],
'mode' => 'edit',
));
//Contact Block
acf_register_block_type(array(
'name' => 'block-contacts',
'title' => __('Contact Block'),
'description' => __('Contact Block'),
'render_template' => 'blocks/block-contacts.php',
'category' => 'formatting',
'icon' => 'phone',
'keywords' => array( 'Contact'),
'example' => [],
'mode' => 'edit',
));
}
}
function wp4378295342_maybe_add_template() {
global $pagenow;
if ( ! isset( $_GET['post_type'] ) ) {
$post_type = 'post';
} elseif ( in_array( $_GET['post_type'], get_post_types( array( 'show_ui' => true ) ), true ) ) {
$post_type = $_GET['post_type'];
} else {
wp_die( __( 'Invalid post type.' ) );
}
if ( is_admin() && ($pagenow === 'post-new.php' && $post_type === 'post')) {} else {
return false;
}
$post_type_object = get_post_type_object( 'post' );
$post_type_object->template = array(
array( 'acf/block-single-content', array()),
array( 'acf/block-articles', array())
);
}
add_action( 'admin_menu', 'wp4378295342_maybe_add_template' );