File: /mnt/data/kofejob-wp/wp-content/themes/kofejob/inc/theme-settings.php
<?php
add_theme_support( 'woocommerce' );
add_theme_support('wc-product-gallery-zoom');
add_theme_support('wc-product-gallery-lightbox');
add_theme_support('wc-product-gallery-slider');
if ( ! isset( $content_width ) ) {
$content_width = 600;
}
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'footer_menu' => esc_html__( 'Kofejob Footer Menu', 'kofejob' ),
) );
// Register SIDEBARS
function kofejob_my_search_form( $form ) {
$form = '<form method="get" class="search-form" action="' . home_url( '/' ) . '">
<div class="fl-search-blog"><div class="input-group stylish-input-group">
<input type="search" class="form-control" placeholder="' .esc_attr__( 'Search... ', 'kofejob' ). '" value="'.get_search_query().'" name="s" required="" id="s"/>
<span class="input-group-append"><button class="blog-search-btn" type="submit"> <i class="fa fa-search"></i> </button></span></div></div>
</form>';
return $form;
}
add_filter( 'get_search_form', 'kofejob_my_search_form', 100 );
function kofejob_project_sidebar()
{
$args = array(
'id' => 'kofejob-project-widgets',
'name' => __( 'Kofejob Project Sidebar Widgets', 'kofejob' ),
'description' => __( 'All the project page sidebar widgets will be placed here.', 'kofejob' ),
'before_title' => '',
'after_title' => '<',
'before_widget' => '',
'after_widget' => '',
);
register_sidebar( $args );
}
add_action( 'widgets_init', 'kofejob_project_sidebar' );
function kofejob_freelancer_sidebar()
{
$args = array(
'id' => 'kofejob-freelancer-widgets',
'name' => __( 'Kofejob Freelancer Sidebar Widgets', 'kofejob' ),
'description' => __( 'All the freelancer page sidebar widgets will be placed here.', 'kofejob' ),
'before_title' => '',
'after_title' => '<',
'before_widget' => '',
'after_widget' => '',
);
register_sidebar( $args );
}
add_action( 'widgets_init', 'kofejob_freelancer_sidebar' );
function kofejob_footerarea_sidebar()
{
$args = array(
'id' => 'kofejob-footerarea-widgets',
'name' => __( 'Kofejob footerarea Sidebar', 'kofejob' ),
'description' => __( 'Footer area sidebar widgets will be placed in footer.', 'kofejob' ),
'before_widget' => '<div class="widget %2$s">',
'after_widget' => '</div></div>',
'before_title' => '<div class="widget-heading"><div class="panel-title"><h2 class="footer-title">',
'after_title' => '</h2></div></div><div class="widget-content saftey">'
);
register_sidebar( $args );
}
add_action( 'widgets_init', 'kofejob_footerarea_sidebar' );
function kofejob_blog_sidebar() {
$args = array(
'id' => 'kofejob-blog-widget',
'class'=> 'nav-list',
'name' => __( 'Kofejob Blog Widget', 'kofejob' ),
'description' => __( 'All the blog page widgets will be placed here.', 'kofejob' ),
'before_title' => '<h4 class="pro-title">',
'after_title' => '</h4>',
'before_widget' => '<div id="%1$s" class="pro-post widget-box %2$s"><div class="pro-content pt-0">',
'after_widget' => '</div></div>',
);
register_sidebar( $args );
}
add_action( 'widgets_init', 'kofejob_blog_sidebar' );
function kofejob_blog_sidebar_new()
{
register_sidebar(
array(
'name' => esc_html__('Kofejob Default Widget ', 'kofejob'),
'id' => 'sidebar-1',
'description' => __( 'All the blog page widgets will be placed here.', 'kofejob' ),
'before_title' => '<h4 class="pro-title">',
'after_title' => '</h4>',
'before_widget' => '<div id="%1$s" class="pro-post widget-box %2$s"><div class="pro-content pt-0">',
'after_widget' => '</div></div>',
)
);
}
add_action('widgets_init', 'kofejob_blog_sidebar_new');
function kofejob_enqueue_block_styles() {
wp_enqueue_style(
'kofejob-block-styles',
get_template_directory_uri() . '/assets/css/block-styles.css',
array(),
'1.0'
);
}
add_action('enqueue_block_assets', 'kofejob_enqueue_block_styles');
function kofejob_register_block_styles() {
register_block_style(
'core/paragraph',
array(
'name' => 'highlighted-text',
'label' => esc_html__('Highlighted Text', 'kofejob'),
)
);
}
add_action('init', 'kofejob_register_block_styles');
function kofejob_register_block_patterns() {
// Check if block patterns are supported
if ( function_exists( 'register_block_pattern' ) ) {
// Register a Hero Section Block Pattern
register_block_pattern(
'kofejob/hero-section',
array(
'title' => esc_html__( 'Hero Section', 'kofejob' ),
'description' => esc_html__( 'A hero section with a heading, subheading, and call-to-action button.', 'kofejob' ),
'content' => '<!-- wp:cover {"overlayColor":"primary","minHeight":500,"align":"full"} -->
<div class="wp-block-cover alignfull" style="min-height:500px">
<span aria-hidden="true" class="has-primary-background-color has-background-dim-100"></span>
<div class="wp-block-cover__inner-container">
<!-- wp:heading {"textAlign":"center"} -->
<h2 class="has-text-align-center">' . esc_html__( 'Welcome to Kofejob', 'kofejob' ) . '</h2>
<!-- /wp:heading -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">' . esc_html__( 'Explore the best job opportunities.', 'kofejob' ) . '</p>
<!-- /wp:paragraph -->
<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">
<!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link">' . esc_html__( 'Get Started', 'kofejob' ) . '</a></div>
<!-- /wp:button -->
</div>
<!-- /wp:buttons -->
</div>
</div>
<!-- /wp:cover -->',
'categories' => array( 'featured', 'header' ),
)
);
}
}
add_action( 'init', 'kofejob_register_block_patterns' );
function kofejob_theme_support() {
// Enable support for core block styles.
add_theme_support( 'wp-block-styles' );
// Optionally, enable support for other block editor features:
// Add wide alignment for blocks.
add_theme_support( 'align-wide' );
// Add support for responsive embeds.
add_theme_support( 'responsive-embeds' );
// Add support for editor styles.
add_theme_support( 'editor-styles' );
// Enqueue a custom editor style.
add_editor_style( 'editor-style.css' );
// Enable HTML5 support for specific elements
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'style',
'script',
) );
}
add_action( 'after_setup_theme', 'kofejob_theme_support' );
function kofejob_add_custom_logo_support() {
// Add theme support for a custom logo
add_theme_support( 'custom-logo', array(
'height' => 100, // Default height
'width' => 300, // Default width
'flex-height' => true, // Allow flexible height
'flex-width' => true, // Allow flexible width
'header-text' => array( 'site-title', 'site-description' ), // Define header text to show/hide
) );
}
add_action( 'after_setup_theme', 'kofejob_add_custom_logo_support' );
function kofejob_add_custom_header_support() {
// Add support for custom header
add_theme_support( 'custom-header', array(
'default-image' => get_template_directory_uri() . '/assets/images/default-header.jpg', // Default header image
'width' => 1920, // Default image width
'height' => 1080, // Default image height
'flex-height' => true, // Allow flexible height
'flex-width' => true, // Allow flexible width
'header-text' => true, // Enable header text
'default-text-color' => '000000', // Default text color
'wp-head-callback' => 'kofejob_header_style', // Callback for styles
) );
}
add_action( 'after_setup_theme', 'kofejob_add_custom_header_support' );
function kofejob_add_custom_background_support() {
// Add support for custom background
add_theme_support( 'custom-background', array(
'default-color' => 'ffffff', // Default background color (optional)
'default-image' => '', // Default background image (optional)
'default-repeat' => 'no-repeat', // Default image repeat behavior
'default-position-x' => 'center', // Default horizontal position
'default-position-y' => 'top', // Default vertical position
'default-size' => 'cover', // Default background image size
'default-attachment' => 'scroll', // Default scroll behavior
) );
}
add_action( 'after_setup_theme', 'kofejob_add_custom_background_support' );