92, 'width' => 92, 'flex-height' => true, 'flex-width' => true, 'header-text' => array(), ) ); add_theme_support( 'custom-background' ); add_theme_support( 'custom-background', array( 'default-color' => 'ffffff', ) ); add_theme_support( 'custom-header' ); add_theme_support( 'custom-header', array( 'default-image' => '', 'width' => 2880, 'height' => 92, 'flex-height' => true, 'flex-width' => true, 'uploads' => true, 'random-default' => false, 'header-text' => false, 'default-text-color' => '', 'wp-head-callback' => '', 'admin-head-callback' => '', 'admin-preview-callback' => '', ) ); register_nav_menus( array( 'header-menu' => __( 'Header Menu', 'basique' ), 'footer-menu' => __( 'Footer Menu', 'basique') ) ); add_editor_style( array( 'assets/editor-style.css' ) ); $starter_content = apply_filters( 'basique_starter_content', array( 'widgets' => array( 'header-widget-area' => array( 'search', ), /* Later Support 'sidebar-widget-area' => array( '', ), */ 'footer-widget-area' => array( '', ), ), ) ); add_theme_support( 'starter-content', $starter_content ); add_image_size( 'basique-large', 1920, 1200, false ); add_image_size( 'basique-content', 800, 500, false ); add_image_size( 'basique-logo', 92, 92, false ); } add_action( 'after_setup_theme', 'basique_setup' ); function basique_tagcount_filter ($variable) { $variable = str_replace( ' (', '•', $variable ); $variable = str_replace( ')', '', $variable ); return $variable; } add_filter('wp_tag_cloud','basique_tagcount_filter'); // Customize Search Form function basique_search_form( $form ) { $form = '
'; return $form; } add_filter( 'get_search_form', 'basique_search_form' ); add_filter( 'the_title', 'basique_title' ); function basique_title( $title ) { if ( $title == '' ) { return '→'; } else { return $title; } } add_action( 'after_setup_theme', function ( $buffer ) { function basique_strip_buffer( $buffer ) { $buffer = preg_replace( '//', '', $buffer ); return $buffer; } function basique_buffer_start() { ob_start( "basique_strip_buffer" ); } function basique_buffer_end() { ob_end_flush(); } add_action('get_header', 'basique_buffer_start'); add_action('wp_footer', 'basique_buffer_end'); } ); add_filter( 'the_content', 'escape_code_fragments' ); add_filter( 'pre_comment_content', 'escape_code_fragments' ); function escape_code_fragments( $source ) { $encoded = preg_replace_callback( '/(.*?)<\/code>/ims', create_function (
'$matches',
'$matches[2] = preg_replace( array("/^[\r|\n]+/i", "/[\r|\n]+$/i"), "", $matches[2] ); return "" . esc_html( $matches[2] ) . "";' ), $source );
if ($encoded) {
return $encoded;
} else {
return $source;
}
}
function _remove_script_version( $src ){
$parts = explode( '?', $src );
return $parts[0];
}
add_filter( 'script_loader_src', '_remove_script_version', 15, 1 );
add_filter( 'style_loader_src', '_remove_script_version', 15, 1 );
add_action( 'wp_enqueue_scripts', 'basique_load_scripts' );
function basique_load_scripts()
{
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_style( 'font', get_template_directory_uri() . '/assets/css/fonts.css' );
wp_enqueue_script ( 'act', get_template_directory_uri() . '/assets/js/act.js' );
function basique_optimize_scripts( $tag, $handle )
{
$scripts_to_optimize = array(
'act'
);
foreach( $scripts_to_optimize as $basique_script )
{
if ( $basique_script === $handle )
{
return str_replace( 'src', 'defer src', $tag );
}
}
return $tag;
}
add_filter('script_loader_tag', 'basique_optimize_scripts', 10, 2);
}
// Register Widget Areas
add_action( 'widgets_init', 'basique_widgets_init' );
function basique_widgets_init()
{
// Primary - Widget Area
register_sidebar( array (
'name' => __( 'Header Widget Area', 'basique' ),
'id' => 'header-widget-area',
'description' => 'Add widgets in this area to display them on header area.',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
// Secondary - Widget Area
/*
register_sidebar( array (
'name' => __( 'Sidebar Widget Area', 'basique' ),
'id' => 'sidebar-widget-area',
'description' => 'Add widgets in this area to display them on sidebar area.',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
) );*/
// Footer - Widget Area
register_sidebar( array (
'name' => __( 'Footer Widget Area', 'basique' ),
'id' => 'footer-widget-area',
'description' => 'Add widgets in this area to display them on footer area.',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
}
// Reply Comment Form
add_action( 'comment_form_before', 'basique_enqueue_comment_reply_script' );
function basique_enqueue_comment_reply_script() {
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
function basique_custom_pings( $comment ) {
$GLOBALS['comment'] = $comment;
?>
id="li-comment-">