__('Custom Pattern 1', 'azakios'),
'description' => __('A description of your custom pattern.', 'azakios'),
'content' => '',
'categories' => array('text', 'columns'), // Choose relevant categories.
'keywords' => array('custom', 'pattern', 'layout'),
)
);
}
add_action('init', 'azakios_register_block_patterns');
function azakios_register_block_styles() {
register_block_style(
'core/quote',
array(
'name' => 'fancy-quote',
'label' => __('Fancy Quote', 'azakios'),
'style_handle' => 'azakios-fancy-quote-style', // Enqueue your custom styles here.
)
);
}
add_action('init', 'azakios_register_block_styles');
function add_theme_scripts() {
// Enqueue your theme's main style.css file
wp_enqueue_style('style', get_stylesheet_uri());
// Enqueue your custom theme-specific styles (core.css)
wp_enqueue_style('azakios_theme_style', get_template_directory_uri() . '/assets/css/core.css', array(), '1.1', 'all');
wp_enqueue_style(
'azakios-fancy-quote-style',
get_template_directory_uri() . '/assets/css/fancy-quote-style.css',
array(),
'1.0', // Version number.
'all' // Media type (all, screen, print, etc.).
);
// Enqueue your custom JavaScript files
wp_enqueue_script('script', get_template_directory_uri() . '/assets/js/script.js', array('jquery'), '1.1', true);
wp_enqueue_script('core-js', get_template_directory_uri() . '/assets/js/core.js', array('jquery'), '1.0', true);
// Enqueue wp-core.css (assuming it's located in your theme's assets/css directory)
wp_enqueue_style('wp-core-style', get_template_directory_uri() . '/assets/css/wp-core.css', array(), '1.0', 'all');
wp_enqueue_style('404-style', get_template_directory_uri() . '/assets/css/404.css', array(), '1.0', 'all');
// Check if it's a singular page with open comments and threaded comments are enabled
if (is_singular() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
// Add the style.css file for the WordPress editor
add_editor_style('style.css');
}
add_action('wp_enqueue_scripts', 'add_theme_scripts');
function register_my_menus() {
register_nav_menus(
array(
'primary' => __( 'Primary Menu', 'azakios' ),
'header-menu' => __( 'Header Menu', 'azakios' ),
'extra-menu' => __( 'Extra Menu', 'azakios' )
)
);
}
add_action( 'init', 'register_my_menus' );
/********************************/
/**********************/
function get_the_top_ancestor_id() {
global $post;
if ( $post->post_parent ) {
$ancestors = array_reverse( get_post_ancestors( $post->ID ) );
return $ancestors[0];
} else {
return $post->ID;
}
}
/* sets the excerpt length */
function customize_the_excerpt_length() {
return 30;
}
add_filter( 'excerpt_length', 'customize_the_excerpt_length' );
/* Add Featured Image Support To Your WordPress Theme */
function add_featured_image_support_to_your_wordpress_theme() {
add_theme_support( 'post-thumbnails' );
add_image_size( 'small-thumbnail', 100, 100, true );
add_image_size( 'single-post-image', 960, 250, true );
add_theme_support( 'post-formats', [
'aside',
'gallery',
'link',
'image',
'quote',
'status',
'video',
'audio',
'chat',
'standard'
] );
}
add_action( 'after_setup_theme', 'add_featured_image_support_to_your_wordpress_theme' );
function initialize_widgets() {
register_sidebar( [
'name' => 'Right Sidebar',
'id' => 'rightsidebar',
'before_widget' => '
',
'after_widget' => '
'
] );
register_sidebar( [
'name' => 'Footer 1',
'id' => 'footer1',
'before_widget' => '',
'after_widget' => '
'
] );
register_sidebar( [
'name' => 'Footer 2',
'id' => 'footer2',
'before_widget' => '',
'after_widget' => '
'
] );
register_sidebar( [
'name' => 'Footer 3',
'id' => 'footer3',
'before_widget' => '',
'after_widget' => '
'
] );
register_sidebar( [
'name' => 'Footer 4',
'id' => 'footer4',
'before_widget' => '',
'after_widget' => '
'
] );
register_sidebar( [
'name' => 'Footer Above',
'id' => 'footerabove',
'before_widget' => '',
'after_widget' => '
'
] );
}
add_action( 'widgets_init', 'initialize_widgets' );
/*--------------------------*/
function register_azakios_widget_area() {
register_sidebar(array(
'name' => __('Header Widget Area', 'azakios'),
'id' => 'header_widget',
'description' => __('Add widgets here to display in the header.', 'azakios'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}
add_action('widgets_init', 'register_azakios_widget_area');
/*--------------------------*/
function register_azakios_widget_area1() {
register_sidebar(array(
'name' => __('Header Widget Area1', 'azakios'),
'id' => 'header_widget_head_menu',
'description' => __('Add widgets here to display in the header.', 'azakios'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}
add_action('widgets_init', 'register_azakios_widget_area1');
/*--------------------------*/
function register_azakios_widget_area2() {
register_sidebar(array(
'name' => __('Header Widget Area2', 'azakios'),
'id' => 'header_widget_logo',
'description' => __('Add widgets here to display in the header.', 'azakios'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}
add_action('widgets_init', 'register_azakios_widget_area2');
/*--------------------------*/
function register_azakios_widget_footer_copyright() {
register_sidebar(array(
'name' => __('Footer Copyright Widget ', 'azakios'),
'id' => 'footer_copyright_widget',
'description' => __('Add widgets here to display in the header.', 'azakios'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}
add_action('widgets_init', 'register_azakios_widget_footer_copyright');
function azakios_theme_customizer_settings($wp_customize) {
// Add a section for theme options
$wp_customize->add_section('header_section', array(
'title' => __('Header Options', 'azakios'),
'priority' => 30,
));
// Add a setting for header background color
$wp_customize->add_setting('header_background_color', array(
'default' => '#333333',
'sanitize_callback' => 'sanitize_hex_color',
));
// Add a control for header background color
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'header_background_color', array(
'label' => __('Header Background Color', 'azakios'),
'section' => 'header_section',
)));
// Add a setting for title color
$wp_customize->add_setting('title_color', array(
'default' => '#333333',
'sanitize_callback' => 'sanitize_hex_color',
));
// Add a control for title color
$wp_customize->add_control(new WP_Customize_Color_Control($wp_customize, 'title_color', array(
'label' => __('Title Color', 'azakios'),
'section' => 'header_section',
)));
}
add_action('customize_register', 'azakios_theme_customizer_settings');
function azakios_theme_customizer_css() {
$header_background_color = get_theme_mod('header_background_color', '#333333');
$title_color = get_theme_mod('title_color', '#333333'); // Retrieve title color setting
// Output the custom CSS
echo '';
}
add_action('wp_head', 'azakios_theme_customizer_css');
/************************/
function azakios_customize_register($wp_customize) {
// Logo Section
$wp_customize->add_section('logo_section', array(
'title' => __('Logo Options', 'azakios'),
'priority' => 30,
));
// Display Logo
$wp_customize->add_setting('display_logo', array(
'default' => true,
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('display_logo', array(
'label' => __('Display Logo', 'azakios'),
'section' => 'logo_section',
'type' => 'checkbox',
));
// Custom Logo
$wp_customize->add_setting('custom_logo', array(
'sanitize_callback' => 'esc_url_raw',
));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'custom_logo', array(
'label' => __('Custom Logo', 'azakios'),
'section' => 'logo_section',
)));
// Display Title
$wp_customize->add_setting('display_title', array(
'default' => true,
'sanitize_callback' => 'sanitize_text_field',
));
$wp_customize->add_control('display_title', array(
'label' => __('Display Title', 'azakios'),
'section' => 'logo_section',
'type' => 'checkbox',
));
// Logo Size
$wp_customize->add_setting('logo_size', array(
'default' => 100, // Set your default logo size
'sanitize_callback' => 'absint',
));
$wp_customize->add_control('logo_size', array(
'label' => __('Logo Size', 'azakios'),
'section' => 'logo_section',
'type' => 'number',
'input_attrs' => array(
'min' => 50, // Set minimum logo size
'max' => 200, // Set maximum logo size
'step' => 1,
),
));
}
add_action('customize_register', 'azakios_customize_register');
function custom_posts_per_page($query) {
if ($query->is_main_query() && !is_admin()) {
$query->set('posts_per_page', 10); // Adjust the number accordingly
}
}
add_action('pre_get_posts', 'custom_posts_per_page');