'f4f6f8',);
add_theme_support( 'custom-background', $defaults );
/* Add support for Custom Logo
==================================== */
add_theme_support( 'custom-logo', array(
'height' => 150,
'width' => 300,
'flex-width' => true,
'flex-height' => true,
) );
/* Add support for post and comment RSS feed links in
==================================== */
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 140, 240, false );
/* Add support for Localization
==================================== */
load_theme_textdomain( 'city-hall', get_template_directory() . '/languages' );
$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";
if ( is_readable($locale_file) )
require_once($locale_file);
/* Add support for Custom Headers
==================================== */
add_theme_support(
'custom-header', apply_filters(
'academia_custom_header_args', array(
'width' => 1600,
'height' => 500,
'flex-height' => true,
'video' => false,
'header-text' => false
)
)
);
// Register nav menus
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'city-hall' ),
'mobile' => __( 'Mobile Menu', 'city-hall' ),
'secondary' => __( 'Secondary Menu', 'city-hall' ),
'footer' => __( 'Footer Menu', 'city-hall' )
) );
/* Remove support for Block Based Widgets
==================================== */
remove_theme_support( 'widgets-block-editor' );
}
endif;
add_action( 'after_setup_theme', 'city_hall_setup' );
add_filter( 'image_size_names_choose', 'city_hall_custom_sizes' );
function city_hall_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'thumb-academia-slideshow' => __( 'Featured Image: Slideshow Size', 'city-hall' ),
'thumb-featured-page' => __( 'Featured Image: Page Thumbnail', 'city-hall' ),
'post-thumbnail' => __( 'Featured Image: Thumbnail', 'city-hall' ),
) );
}
/* Add javascripts and CSS used by the theme
================================== */
function city_hall_js_scripts() {
$theme_version = wp_get_theme()->get( 'Version' );
// Theme stylesheet.
wp_enqueue_style( 'city-hall-style', get_stylesheet_uri(), array(), $theme_version );
// Add Dashicons font.
wp_enqueue_style( 'dashicons' );
if (! is_admin()) {
wp_enqueue_script(
'jquery-superfish',
get_template_directory_uri() . '/js/superfish.min.js',
array('jquery'),
true
);
wp_enqueue_script(
'jquery-fitvids',
get_template_directory_uri() . '/js/jquery.fitvids.js',
array('jquery'),
'1.7.10',
true
);
wp_enqueue_script(
'city-hall-init',
get_template_directory_uri() . '/js/city-hall.js',
array('jquery'),
$theme_version,
true
);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
/* Font-Awesome */
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', null, '4.7.0');
}
}
add_action('wp_enqueue_scripts', 'city_hall_js_scripts');
function city_hall_enqueue_fonts() {
// Include the file.
require_once get_theme_file_path( 'academia-admin/components/wptt-webfont-loader.php' );
// Load the webfont.
wp_enqueue_style(
'ibm-plex-sans',
wptt_get_webfont_url( 'https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&family=Open+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400;1,700&display=swap' ),
array(),
'1.0'
);
}
add_action( 'wp_enqueue_scripts', 'city_hall_enqueue_fonts' );
/**
* --------------------------------------------
* Enqueue scripts and styles for the backend.
* --------------------------------------------
*/
if ( ! function_exists( 'academiathemes_scripts_admin' ) ) {
/**
* Enqueue admin styles and scripts
*
* @since 2.0.0
* @return void
*/
function academiathemes_scripts_admin( $hook ) {
// Styles
wp_enqueue_style(
'city-hall-style-admin',
get_template_directory_uri() . '/academia-admin/css/academiathemes_theme_settings.css',
'', ACADEMIATHEMES_VERSION, 'all'
);
// Scripts
wp_enqueue_script(
'academiathemes-scripts-admin',
get_template_directory_uri() . '/academia-admin/js/academiathemes-admin.js',
[ 'jquery' ], ACADEMIATHEMES_VERSION, true
);
}
}
add_action( 'admin_enqueue_scripts', 'academiathemes_scripts_admin' );
/* Custom Archives titles.
=================================== */
if ( ! function_exists( 'city_hall_get_the_archive_title' ) ) :
function city_hall_get_the_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
}
return $title;
}
endif;
add_filter( 'get_the_archive_title', 'city_hall_get_the_archive_title' );
/* Enable Excerpts for Static Pages
==================================== */
add_action( 'init', 'city_hall_excerpts_for_pages' );
function city_hall_excerpts_for_pages() {
add_post_type_support( 'page', 'excerpt' );
}
/* Custom Excerpt Length
==================================== */
function city_hall_new_excerpt_length($length) {
if ( is_admin() ) { return $length; }
else { return 30; }
}
add_filter('excerpt_length', 'city_hall_new_excerpt_length');
/* Replace invalid ellipsis from excerpts
==================================== */
function city_hall_excerpts($text)
{
$text = str_replace(' […]', '…', $text);
$text = str_replace('[…]', '…', $text);
$text = str_replace('[...]', '...', $text);
return $text;
}
add_filter('excerpt_more', 'city_hall_excerpts');
/* Convert HEX color to RGB value (for the customizer)
==================================== */
function city_hall_hex2rgb($hex) {
$hex = str_replace("#", "", $hex);
if(strlen($hex) == 3) {
$r = hexdec(substr($hex,0,1).substr($hex,0,1));
$g = hexdec(substr($hex,1,1).substr($hex,1,1));
$b = hexdec(substr($hex,2,1).substr($hex,2,1));
} else {
$r = hexdec(substr($hex,0,2));
$g = hexdec(substr($hex,2,2));
$b = hexdec(substr($hex,4,2));
}
$rgb = "$r, $g, $b";
return $rgb; // returns an array with the rgb values
}
/**
* Add a pingback url auto-discovery header for singularly identifiable articles.
*/
function city_hall_pingback_header() {
if ( is_singular() && pings_open() ) {
printf( '' . "\n", get_bloginfo( 'pingback_url' ) );
}
}
add_action( 'wp_head', 'city_hall_pingback_header' );
/**
* Adds custom classes to the array of body classes.
*
* @since City Hall 1.0
*
* @param array $classes Classes for the body element.
* @return array (Maybe) filtered body classes.
*/
function city_hall_body_classes( $classes ) {
$classes[] = academiathemes_helper_get_page_hero_status();
$classes[] = academiathemes_helper_get_header_style();
$classes[] = academiathemes_helper_get_menu_style();
$classes[] = academiathemes_helper_get_sidebar_position();
return $classes;
}
add_filter( 'body_class', 'city_hall_body_classes' );
/**
* Fix skip link focus in IE11.
*
* This does not enqueue the script because it is tiny and because it is only for IE11,
* thus it does not warrant having an entire dedicated blocking script being loaded.
*
* @link https://git.io/vWdr2
*/
function city_hall_skip_link_focus_fix() {
// The following is minified via `terser --compress --mangle -- js/skip-link-focus-fix.js`.
?>
%2$s',
esc_url( home_url( '/' ) ),
wp_get_attachment_image( $custom_logo_id, 'full', false, array(
'class' => 'custom-logo',
'alt' => __('Logo for ','city-hall') . esc_attr($site),
) )
);
echo $html;
}
}
}
}
if ( ! function_exists( 'city_hall_comment' ) ) :
/**
* Template for comments and pingbacks.
* Used as a callback by wp_list_comments() for displaying the comments.
*/
function city_hall_comment( $comment, $args, $depth ) {
if ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) : ?>