get( 'Version' ) );
} else {
// If not IE, use the standard stylesheet.
wp_enqueue_style( 'smntcs-retro-style', get_template_directory_uri() . '/style.css', array(), wp_get_theme()->get( 'Version' ) );
}
wp_enqueue_style( 'smntcs-retro-search-style', get_template_directory_uri() . '/search.css', array(), wp_get_theme()->get( 'Version' ) );
// RTL styles.
wp_style_add_data( 'smntcs-retro-style', 'rtl', 'replace' );
}
add_action( 'wp_enqueue_scripts', 'smntcs_retro_register_styles' );
/**
* Register and enqueue scripts.
*
* @since 1.0.0
*/
function smntcs_retro_register_scripts() {
if ( ( ! is_admin() ) && is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script( 'search-script', get_template_directory_uri() . '/assets/js/search.js', array(), '1.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'smntcs_retro_register_scripts' );
/**
* Register navigation menu.
*
* @since 1.0.0
*/
function smntcs_retro_menus() {
$locations = array(
'primary' => __( 'Primary Menu', 'smntcs-retro' ),
'footer' => __( 'Footer Menu', 'smntcs-retro' ),
);
register_nav_menus( $locations );
}
add_action( 'init', 'smntcs_retro_menus' );
/**
* Register footer widget section
*
* @since 1.0.0
*/
function smntcs_retro_sidebars() {
register_sidebar(
array(
'id' => 'footer-sidebar-left',
'name' => __( 'Footer Sidebar Left', 'smntcs-retro' ),
'description' => __( 'Add widgets to the footer sidebar left.', 'smntcs-retro' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
)
);
register_sidebar(
array(
'id' => 'footer-sidebar-right',
'name' => __( 'Footer Sidebar Right', 'smntcs-retro' ),
'description' => __( 'Add widgets to the footer sidebar right.', 'smntcs-retro' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
}
add_action( 'widgets_init', 'smntcs_retro_sidebars' );
if ( ! function_exists( 'wp_body_open' ) ) {
/**
* Shim for wp_body_open, ensuring backwards compatibility with versions of WordPress older than 5.2.
*
* @since 1.0.0
*/
function wp_body_open() {
do_action( 'wp_body_open' );
}
}
/**
* Include a skip to content link at the top of the page so that users can bypass the menu.
*
* @since 1.0.0
*/
function smntcs_retro_skip_link() {
echo '' . __( 'Skip to the content', 'smntcs-retro' ) . ''; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- core trusts translations
}
add_action( 'wp_body_open', 'smntcs_retro_skip_link', 5 );
/**
* Sanitize checkbox field.
*
* @since 1.6.0
* @param bool $checked Whether or not a box is checked.
* @return bool True if checkbox is activated, othewise false
*/
function smntcs_retro_sanitize_checkbox( $checked ) {
return ( ( isset( $checked ) && true === $checked ) ? true : false );
}
/**
* Sanitize radio field.
*
* @param mixed $input The input to sanitize.
* @param mixed $setting The settings object.
* @return bool True if select field is valid, othewise false
*/
function smntcs_retro_sanitize_radio( $input, $setting ) {
$input = sanitize_key( $input );
$choices = $setting->manager->get_control( $setting->id )->choices;
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
/**
* Sanitize radio field.
*
* @param mixed $input The input to sanitize.
* @param mixed $setting The settings object.
* @return bool True if select field is valid, othewise false
*/
function smntcs_retro_sanitize_select( $input, $setting ) {
$input = sanitize_key( $input );
$choices = $setting->manager->get_control( $setting->id )->choices;
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
/**
* Add custom CSS to the site.
*
* @since 1.6.0
* @return void
*/
function smntcs_retro_wp_head() {
if ( get_theme_mod( 'smntcs_retro_centre_site' ) ) {
print( '' );
}
if ( get_theme_mod( 'smntcs_retro_site_width' ) ) {
printf( '', (int) get_theme_mod( 'smntcs_retro_site_width' ) );
}
}
add_action( 'wp_head', 'smntcs_retro_wp_head' );
/**
* Load Dashicons on frontend.
*
* @since 1.13.0
* @return void
*/
function smntcs_retro_wp_enqueue_scripts(){
wp_enqueue_style('dashicons');
}
add_action('wp_enqueue_scripts', 'smntcs_retro_wp_enqueue_scripts', 999);