'blue-quote',
'label' => __( 'Blue Quote', 'bb10' ),
'inline_style' => '.wp-block-quote.is-style-blue-quote { cbb10r: blue; }',
)
);
register_block_pattern(
'bb10/my-awesome-pattern',
array(
'title' => __( 'Two buttons', 'bb10' ),
'description' => _x( 'Two horizontal buttons, the left button is filled in, and the right button is outlined.', 'Block pattern description', 'bb10' ),
'content' => "\n
\n",
)
);
// Add sidebar
add_action( 'widgets_init', 'bb10_widgets' );
add_theme_support( "responsive-embeds" );
add_theme_support( 'align-wide' );
$args = array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
);
add_theme_support( "html5", $args );
// Enable support for Post Formats.
add_theme_support( 'post-formats', array(
'aside',
'gallery',
'link',
'quote',
'status',
) );
//Add custom-header for AD
$bb10_logo = array(
'default-image' => BB10_TPLDIR.'/images/header-logo.png',
'random-default' => false,
'width' => 600,
'height' => 150,
'header-text' => false,
'uploads' => true,
'flex-width' => true,
'flex-height' => true,
);
add_theme_support( 'custom-header', $bb10_logo );
//Add support for core custom logo.
$args = array(
'height' => 100,
'width' => 100,
'flex-width' => true,
'flex-height' => true,
'header-text' => array( 'site-title', 'site-description' ),
);
add_theme_support( "custom-logo", $args );
// Add menu
register_nav_menus( array(
'primary' => __( 'Primary Navigation','bb10'),
'mobile' => __( 'Mobile Navigation', 'bb10'),
) );
};
// add @ for comment
function hjyl_comment_add_at( $comment_text, $comment = '') {
if( $comment->comment_parent > 0) {
$comment_text = '@'.get_comment_author( $comment->comment_parent ) . ' ' . $comment_text;
}
return $comment_text;
}
//bb10 Title Tag
function hjyl_title_separator_to_line(){
return '|';
}
function hjyl_document_title_parts( $title ){
if( is_home() && isset( $title['tagline'] ) ) unset( $title['tagline'] );
//no title
if(is_singular() && ""==get_the_title() ) {
$title['title'] = sprintf(__('Untitled #%s', 'bb10'),get_the_date('Y-m-d'));
};
return $title;
}
//Custom wp_list_pages
function bb10_wp_list_pages(){
echo "";
echo wp_list_pages('title_li=&depth=1');
echo "
";
}
// Enqueue style-file, if it exists.
function bb10_script() {
if( !bb10_IsMobile ){
wp_enqueue_style( 'bb10-style', get_stylesheet_uri(), array(), '20220106', false);
}else{
wp_enqueue_style('bb10-mobile', BB10_TPLDIR . '/css/bb10-mobile.css', array(), '20220106', 'all', false);
};
wp_enqueue_script( 'html5-js', BB10_TPLDIR . '/js/html5.js', array(), '20220106', true);
wp_script_add_data( 'html5-js', 'conditional', 'lt IE 9' );
wp_enqueue_style( 'Play', '//fonts.googleapis.com/css?family=Play', array(), '20220106', 'all');
wp_enqueue_script( 'bb10-js', BB10_TPLDIR . '/js/bb10.js', array('jquery'), '20220106', true);
if ( is_singular() && comments_open() ) {
wp_enqueue_script( 'comment-reply' );
wp_enqueue_script( 'ajax-comment', BB10_TPLDIR . '/js/bb10-comments-ajax.js', array('jquery'), '20220106', true);
}
wp_localize_script( 'ajax-comment', 'ajaxcomment', array(
'ajax_url' => admin_url('admin-ajax.php'),
'order' => get_option('comment_order'),
'formpostion' => 'bottom',
'txt1' => __('Wait a moment...','bb10'),
'txt2' => __('Good Comment','bb10'),
) );
if( is_page('archives') ){
wp_enqueue_script( 'bb10-archives', BB10_TPLDIR . '/js/bb10-archives.js', array(), '20220106', false);
wp_enqueue_style( 'bb10-archives', BB10_TPLDIR . '/css/bb10-archives.css', array(), '20220106', 'all');
};
if(is_404()){
wp_enqueue_style( 'bb10-4041', '//fonts.googleapis.com/css?family=Press+Start+2P', array(), '20220106', 'all');
wp_enqueue_style( 'bb10-4042', '//fonts.googleapis.com/css?family=Oxygen:700', array(), '20220106', 'all');
wp_enqueue_style( 'bb10-4043', BB10_TPLDIR . '/css/bb10-404.css', array(), '20220106', 'all');
}
}
//copyright below single
function bb10_copyright($content) {
if( is_single() ){
$content.= '--'.__('CopyRights','bb10').': '.get_permalink().'
';
}
return $content;
}
//time formats "xxxx ago"
function time_ago($type = 'commennt', $day = 365) {
$d = $type == 'post' ? 'get_post_time' : 'get_comment_time';
//if (time() - $d('U') > 60 * 60 * 24 * $day) return;
echo sprintf(__('%s ago','bb10'), human_time_diff($d('U') , strtotime(current_time('mysql', 0))));
}
function timeago($ptime) {
$ptime = strtotime($ptime);
$etime = time() - $ptime;
if ($etime < 1) return __('Just Now','bb10');
$interval = array(
12 * 30 * 24 * 60 * 60 => __('years ago', 'bb10'),
30 * 24 * 60 * 60 => __('month ago', 'bb10'),
7 * 24 * 60 * 60 => __('weeks ago', 'bb10'),
24 * 60 * 60 => __('days ago', 'bb10'),
60 * 60 => __('hours ago', 'bb10'),
60 => __('minutes ago', 'bb10'),
1 => __('seconds ago', 'bb10')
);
foreach ($interval as $secs => $str) {
$d = $etime / $secs;
if ($d >= 1) {
$r = round($d);
return $r . $str;
}
};
}
// Add sidebar
function bb10_widgets(){
register_sidebar(array(
'name' =>''.__('Home', 'bb10').'',
'id' => 'home',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name'=>''.__('Single', 'bb10').'',
'id' => 'single',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name'=>''.__('404', 'bb10').'',
'id' => 'error',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
));
register_sidebar(array(
'name'=>''.__('Other', 'bb10').'',
'id' => 'other',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
));
}
//move comment field to bottom
function move_comment_field_to_bottom( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}
add_filter( 'comment_form_fields', 'move_comment_field_to_bottom' );
//Load Custom parts
require( get_template_directory() . '/inc/theme_inc.php' );
require( get_template_directory() . '/inc/bbComment.php' );
$bb10_theme_options = get_option('bb10_theme_options');
/**
* @TwnetySeventeen
* Get unique ID.
*/
function hjyl_unique_id( $prefix = '' ) {
static $id_counter = 0;
if ( function_exists( 'wp_unique_id' ) ) {
return wp_unique_id( $prefix );
}
return $prefix . (string) ++$id_counter;
}
/**
* Add SVG definitions to the footer.
*/
function hjyl_include_svg_icons() {
// Define SVG sprite file.
$svg_icons = get_parent_theme_file_path( '/images/svg-icons.svg' );
// If it exists, include it.
if ( file_exists( $svg_icons ) ) {
require_once( $svg_icons );
}
}
add_action( 'wp_footer', 'hjyl_include_svg_icons', 9999 );
/**
* Return SVG markup.
*
*/
function hjyl_get_svg( $args = array() ) {
// Make sure $args are an array.
if ( empty( $args ) ) {
return __( 'Please define default parameters in the form of an array.', 'bb10' );
}
// Define an icon.
if ( false === array_key_exists( 'icon', $args ) ) {
return __( 'Please define an SVG icon filename.', 'bb10' );
}
// Set defaults.
$defaults = array(
'icon' => '',
'title' => '',
'desc' => '',
'fallback' => false,
);
// Parse args.
$args = wp_parse_args( $args, $defaults );
// Set aria hidden.
$aria_hidden = ' aria-hidden="true"';
// Set ARIA.
$aria_labelledby = '';
/*
* Twenty Seventeen doesn't use the SVG title or description attributes; non-decorative icons are described with .screen-reader-text.
*
* However, child themes can use the title and description to add information to non-decorative SVG icons to improve accessibility.
*
* Example 1 with title: 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ) ) ); ?>
*
* Example 2 with title and description: 'arrow-right', 'title' => __( 'This is the title', 'textdomain' ), 'desc' => __( 'This is the description', 'textdomain' ) ) ); ?>
*
* See https://www.paciellogroup.com/blog/2013/12/using-aria-enhance-svg-accessibility/.
*/
if ( $args['title'] ) {
$aria_hidden = '';
$unique_id = hjyl_unique_id();
$aria_labelledby = ' aria-labelledby="title-' . $unique_id . '"';
if ( $args['desc'] ) {
$aria_labelledby = ' aria-labelledby="title-' . $unique_id . ' desc-' . $unique_id . '"';
}
}
// Begin SVG markup.
$svg = '';
return $svg;
}