aira-wordpress/functions.php
2025-02-27 10:23:21 +00:00

175 lines
4.8 KiB
PHP

<?php
/**
* @package Bootscore Child
*
* @version 6.0.0
*/
// Exit if accessed directly
defined('ABSPATH') || exit;
/**
* Enqueue scripts and styles
*/
add_action('wp_enqueue_scripts', 'bootscore_child_enqueue_styles');
function bootscore_child_enqueue_styles() {
// Compiled main.css
$modified_bootscoreChildCss = date('YmdHi', filemtime(get_stylesheet_directory() . '/assets/css/main.css'));
wp_enqueue_style('main', get_stylesheet_directory_uri() . '/assets/css/main.css', array('parent-style'), $modified_bootscoreChildCss);
// style.css
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
// custom.js
// Get modification time. Enqueue file with modification date to prevent browser from loading cached scripts when file content changes.
$modificated_CustomJS = date('YmdHi', filemtime(get_stylesheet_directory() . '/assets/js/custom.js'));
wp_enqueue_script('custom-js', get_stylesheet_directory_uri() . '/assets/js/custom.js', array('jquery'), $modificated_CustomJS, false, true);
}
/* THEME ------------------------------------------------------------------------ */
/**
* Change path to logos
*/
function change_logo_path($logo, $color) {
return get_stylesheet_directory_uri() . '/assets/img/logo/AIRA_logo.svg';
}
add_filter('bootscore/logo', 'change_logo_path', 10, 2);
/**
* Header position and bg
*/
function header_bg_class() {
return "position-relative bg-black";
}
add_filter('bootscore/class/header', 'header_bg_class', 10, 2);
/**
* Footer top classes
*/
function footer_top_class() {
return " ";
}
add_filter('bootscore/class/footer/top', 'footer_top_class', 10, 2);
/**
* Change footer column wrapper classes
*/
function footer_class() {
return "bg-black text-white pt-5";
}
add_filter('bootscore/class/footer/columns', 'footer_class', 10, 2);
/**
* Change footer info classes
*/
function footer_info_class() {
return "bg-black text-white pt-5 pb-4 small";
}
add_filter('bootscore/class/footer/info', 'footer_info_class', 10, 2);
/* BLOCKS ------------------------------------------------------------------------ */
function register_my_block()
{
register_block_type( dirname(__FILE__) . '/src/blocks/featured-image-block/build/featured-image-block/block.json' );
}
add_action('init', 'register_my_block');
/* ADD HEIGHT */
function register_cover_block_styles_1() {
register_block_style(
'core/cover', // name of your block
array(
'name' => 'fixed-height-272', // part of the class that gets added to the block.
'label' => __( ' Fixed Height 272px', 'style-1' ),
)
);
}
add_action( 'init', 'register_cover_block_styles_1' );
function register_cover_block_styles_2() {
register_block_style(
'core/cover', // name of your block
array(
'name' => 'fixed-height-300', // part of the class that gets added to the block.
'label' => __( ' Fixed Height 300px', 'style-2' ),
)
);
}
add_action( 'init', 'register_cover_block_styles_2' );
function register_cover_block_styles_3() {
register_block_style(
'core/cover', // name of your block
array(
'name' => 'fixed-height-400', // part of the class that gets added to the block.
'label' => __( ' Fixed Height 400px', 'style-3' ),
)
);
}
add_action( 'init', 'register_cover_block_styles_3' );
// It doesn't look like fill and outline were added in php, hence have to unregister with JS
/**
* Gutenberg scripts and styles
* @link https://www.billerickson.net/block-styles-in-gutenberg/
*/
function be_gutenberg_scripts() {
wp_enqueue_script(
'be-editor',
get_stylesheet_directory_uri() . '/assets/js/editor.js',
array( 'wp-blocks', 'wp-dom' ),
filemtime( get_stylesheet_directory() . '/assets/js/editor.js' ),
true
);
}
add_action( 'enqueue_block_editor_assets', 'be_gutenberg_scripts' );
if ( ! function_exists( 'bootscore_block_styles' ) ) :
/**
* Register custom block styles
*/
function register_button_block_button() {
register_block_style(
'core/button', // name of your block
array(
'name' => 'bootstrap-primary', // part of the class that gets added to the block.
'label' => __( 'Primary', 'bootstrap-primary' ),
)
);
register_block_style(
'core/button', // name of your block
array(
'name' => 'bootstrap-dark', // part of the class that gets added to the block.
'label' => __( 'Dark', 'bootstrap-dark' ),
)
);
}
endif;
add_action( 'init', 'register_button_block_button' );
/* TEMPLATE PAGE */
/**
* Change one or more classes into my-custom-class
*/
function my_fancy_filter_function() {
return "featured-full-width-img bg-dark text-light mb-4";
}
add_filter('bootscore/class/featured-full-width-img', 'my_fancy_filter_function', 10, 2);