blocks.php 1.68 KB
<?php

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

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') ) {

        acf_register_block_type( array(
            'title'			=> __( 'Carousel', 'client_textdomain' ),
            'name'			=> 'carousel',
            'render_template'	=> 'blocks/carousel/carousel.php',
            'mode'			=> 'edit',
            'supports'		=> [
                'align'			=> false,
                'anchor'		=> true,
                'customClassName'	=> true
            ]
        ));



        acf_register_block(array(
            'name'				=> 'call-out-block',
            'title'				=> __('Call Out Block'),
            'description'		=> __('A custom block for Call Out Block items.'),
            'render_template'	=> 'blocks/call-out-block/call-out-block.php',
            'category'			=> 'layout',
            'icon'				=> 'excerpt-view',
            'mode'			=> 'edit',
            'supports'		=> [
                'align'			=> false,
                'anchor'		=> true,
                'customClassName'	=> true
            ]
        ));
                

        wp_enqueue_style('call-out-block', get_stylesheet_directory_uri() . '/blocks/call-out-block/style.css', array(), '1.0.1' );
                
    }
}

if( function_exists('acf_add_options_page') ) {
    
    acf_add_options_page(array(
        'page_title'    => 'Theme General Settings',
        'menu_title'    => 'Theme Settings',
        'menu_slug'     => 'theme-general-settings',
        'capability'    => 'edit_posts',
        'redirect'      => false
    ));
    
    
}