';
echo '
';
esc_html_e( 'Theme not activated: this theme requires at least WordPress Version 5.0 !', 'kis' );
echo '
';
echo '';
}
add_action( 'admin_notices', 'kis_not_activated_admin_notice' );
// Switch back to previous theme.
switch_theme( $old_theme->stylesheet );
return false;
endif;
}
add_action( 'after_switch_theme', 'kis_check_wp_version', 10, 2 );
/**
* Enqueue original scripts and styles.
*/
function kis_original_scripts() {
wp_enqueue_style( 'kis-default', get_theme_file_uri( '/css/kis-default.css' ), array(), filemtime( get_theme_file_path( '/css/kis-default.css' ) ) );
wp_enqueue_style( 'kis-layout', get_theme_file_uri( '/css/kis-layout.css' ), array(), filemtime( get_theme_file_path( '/css/kis-layout.css' ) ) );
wp_enqueue_style( 'kis-media-queries', get_theme_file_uri( '/css/kis-media-queries.css' ), array(), filemtime( get_theme_file_path( '/css/kis-media-queries.css' ) ) );
wp_enqueue_style( 'kis-merriweather', '//fonts.googleapis.com/css?family=Merriweather:400,400i,700', array( 'kis-default' ), wp_get_theme()->get( 'Version' ) );
wp_enqueue_style( 'kis-open-sans', '//fonts.googleapis.com/css?family=Open+Sans:300,400,600,700', array( 'kis-default' ), wp_get_theme()->get( 'Version' ) );
wp_enqueue_script( 'headroom', get_theme_file_uri( '/js/headroom.min.js' ), array(), filemtime( get_theme_file_path( '/js/headroom.min.js' ) ), true );
wp_enqueue_script( 'kis-main', get_theme_file_uri( '/js/kis-main.js' ), array( 'jquery' ), filemtime( get_theme_file_path( '/js/kis-main.js' ) ), true );
}
add_action( 'wp_enqueue_scripts', 'kis_original_scripts' );
/**
* Disable output of kirki styles if the plugin is disabled or removed.
*/
if ( ! class_exists( 'Kirki' ) ) {
/**
* Function to remove Kirki styles.
*/
function kis_remove_kirki_styles() {
wp_dequeue_style( 'kis_no-kirki' );
wp_deregister_style( 'kis_no-kirki' );
}
add_action( 'wp_enqueue_scripts', 'kis_remove_kirki_styles', 20 );
}
/**
* Add an admin notice if Kirki is disabled or removed.
*/
if ( ! class_exists( 'Kirki' ) ) {
/**
* Function to display admin notice.
*/
function kis_admin_notice__info() {
$class = 'notice notice-info is-dismissible';
$message = __( 'To take full advantage of this theme\'s features in the Customizer, install the Kirki plugin and activate it !', 'kis' );
printf( '%2$s
', esc_attr( $class ), esc_html( $message ) );
}
add_action( 'admin_notices', 'kis_admin_notice__info' );
}
/**
* Give #wpadminbar a fixed position from 600px and under, using inline style since we can't use #wpadminbar in CSS.
*/
function kis_wp_adminbar() {
$wp_adminbar = '
@media screen and (max-width: 600px) {
#wpadminbar {
position: fixed;
}
}';
wp_add_inline_style( 'kis-layout', $wp_adminbar );
}
add_action( 'wp_enqueue_scripts', 'kis_wp_adminbar' );
/**
* Generate custom search form
*
* @param string $form Form HTML.
* @return string Modified form HTML.
*
* @link https://developer.wordpress.org/reference/functions/get_search_form/#comment-369
*/
function kis_search_form( $form ) {
$form =
'';
return $form;
}
add_filter( 'get_search_form', 'kis_search_form' );
/**
* Allow to upload and use SVG.
*
* @see https://themeisle.com/blog/add-svg-to-wordpress/
* @param string $file_types SVG.
*/
function kis_add_file_types_to_uploads( $file_types ) {
$new_filetypes = array();
$new_filetypes['svg'] = 'image/svg+xml';
$file_types = array_merge( $file_types, $new_filetypes );
return $file_types;
}
add_action( 'upload_mimes', 'kis_add_file_types_to_uploads' );
/**
* Modify The Read More Link Text.
*
* @see https://codex.wordpress.org/Customizing_the_Read_More
*/
function kis_read_more_link() {
return ' [ Read more ] ';
}
add_filter( 'the_content_more_link', 'kis_read_more_link' );
/**
* Filter the excerpt length to 20 words.
*
* @see https://developer.wordpress.org/reference/functions/the_excerpt/#comment-325
* @param int $length Excerpt length.
* @return int (Maybe) modified excerpt length.
*/
function wpdocs_custom_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'wpdocs_custom_excerpt_length', 999 );
/**
* Replaces the excerpt "Read More" text by a link.
*
* @see https://codex.wordpress.org/Customizing_the_Read_More
* @param string $more Link to the article.
*/
function kis_excerpt_more( $more ) {
global $post;
return ' [ Read more ] ';
}
add_filter( 'excerpt_more', 'kis_excerpt_more' );
/**
* Change the HTML5 output of comments.
*
* @see wp_list_comments()
*
* @param WP_Comment $comment Comment to display.
* @param array $args An array of arguments.
* @param int $depth Depth of the current comment.
*/
function kis_comments_callback( $comment, $args, $depth ) {
$tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
?>
< id="comment-" >
'',
'twitter' => '',
'googleplus' => '',
'wordpress' => '',
'email' => '',
);
// Filtering the function, allowing user(s) to add more social sites in child theme.
return apply_filters( 'kis_social_sites', $social_sites );
}
/**
* Get user input from the Customizer and output the linked social media site icon.
*/
function kis_social_media_icons() {
$social_sites = kis_social_sites();
/* any inputs that aren't empty are stored in $active_sites array */
foreach ( $social_sites as $social_site => $profile ) {
if ( strlen( get_theme_mod( $social_site ) ) > 0 ) {
$active_sites[] = $social_site;
}
}
/* for each active social site, add it as a list item */
if ( ! empty( $active_sites ) ) {
foreach ( $active_sites as $key => $active_site ) {
/* setup the class */
$class = 'dashicons dashicons-' . $active_site;
if ( 'email' === $active_site ) {
?>
|
LebCit' );
?>
|
Styleshout' );
?>