60,
'width' => 200,
'flex-height' => true,
'flex-width' => true,
) );
add_theme_support( 'editor-styles' );
// Image sizes for luxury layouts
add_image_size( 'ophiro-hero', 1920, 1080, true );
add_image_size( 'ophiro-card', 800, 500, true );
add_image_size( 'ophiro-thumb', 400, 300, true );
add_image_size( 'ophiro-gallery', 1200, 800, true );
// Navigation menus
register_nav_menus( array(
'primary' => esc_html__( 'Primary Navigation', 'ophiro' ),
'footer' => esc_html__( 'Footer Navigation', 'ophiro' ),
) );
}
add_action( 'after_setup_theme', 'ophiro_setup' );
/**
* Content width
*/
function ophiro_content_width() {
$GLOBALS['content_width'] = apply_filters( 'ophiro_content_width', 1400 );
}
add_action( 'after_setup_theme', 'ophiro_content_width', 0 );
/**
* Register widget areas
*/
function ophiro_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'ophiro' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'ophiro' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Column 1', 'ophiro' ),
'id' => 'footer-1',
'description' => esc_html__( 'Footer widget area 1.', 'ophiro' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Column 2', 'ophiro' ),
'id' => 'footer-2',
'description' => esc_html__( 'Footer widget area 2.', 'ophiro' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'ophiro_widgets_init' );
/**
* Custom excerpt length
*/
function ophiro_excerpt_length( $length ) {
return 25;
}
add_filter( 'excerpt_length', 'ophiro_excerpt_length', 999 );
/**
* Custom excerpt more
*/
function ophiro_excerpt_more( $more ) {
return '…';
}
add_filter( 'excerpt_more', 'ophiro_excerpt_more' );
/**
* Add preload for critical fonts
*/
function ophiro_preload_fonts( $urls, $relation_type ) {
if ( 'preconnect' === $relation_type ) {
$urls[] = array(
'href' => 'https://fonts.googleapis.com',
'crossorigin',
);
}
return $urls;
}
add_filter( 'wp_resource_hints', 'ophiro_preload_fonts', 10, 2 );
/**
* Disable WordPress emoji for cleaner code
*/
function ophiro_disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
}
add_action( 'init', 'ophiro_disable_emojis' );
/**
* Add DNS prefetch for performance
*/
function ophiro_dns_prefetch() {
echo '' . "\n";
}
add_action( 'wp_head', 'ophiro_dns_prefetch', 1 );