tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Add styling for tiny-mce editor. */ add_editor_style( 'assets/css/editor-style.css' ); /* * 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' ); /* * Add custom image sizes as required by the theme. * * @link https://developer.wordpress.org/reference/functions/add_image_size/ */ add_image_size( 'amathambo-widgets', 90, 90, array( 'center', 'center' ) ); add_image_size( 'amathambo-masonry', 710 ); /* * The theme uses wp_nav_menu() in three locations. */ register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'amathambo' ), 'social' => esc_html__( 'Social', 'amathambo' ), 'footer' => esc_html__( 'Footer', 'amathambo' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'amathambo_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 100, 'width' => 100, 'flex-width' => false, 'flex-height' => false, ) ); /** * Add support for full and wide align images. */ add_theme_support( 'align-wide' ); /** * Add support for Block Styles */ add_theme_support( 'wp-block-styles' ); } add_action( 'after_setup_theme', 'amathambo_setup' ); } // End if(). if ( ! function_exists( 'amathambo_content_width' ) ) { /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function amathambo_content_width() { // This variable is intended to be overruled from themes. // Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}. // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound. $GLOBALS['content_width'] = apply_filters( 'amathambo_content_width', 960 ); } add_action( 'after_setup_theme', 'amathambo_content_width', 0 ); } /** * Register Custom Widgets. */ function amathambo_custom_widgets() { register_widget( 'Amathambo_Popular_Posts' ); register_widget( 'Amathambo_Recent_Posts' ); register_widget( 'Amathambo_Featured_Posts' ); } add_action( 'widgets_init', 'amathambo_custom_widgets' ); if ( ! function_exists( 'amathambo_widgets_init' ) ) { /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function amathambo_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Footer 1', 'amathambo' ), 'id' => 'footer-1', 'description' => esc_html__( 'First of 3 footer widgets.', 'amathambo' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 2', 'amathambo' ), 'id' => 'footer-2', 'description' => esc_html__( 'Second of 3 footer widgets.', 'amathambo' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 3', 'amathambo' ), 'id' => 'footer-3', 'description' => esc_html__( 'Third of 3 footer widgets.', 'amathambo' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'amathambo_widgets_init' ); } // End if(). if ( ! function_exists( 'amathambo_scripts' ) ) { /** * Enqueue scripts and styles. */ function amathambo_scripts() { wp_enqueue_style( 'amathambo-style', get_stylesheet_uri() ); wp_enqueue_style( 'dashicons' ); wp_enqueue_style( 'amathambo-genericons', get_template_directory_uri() . '/assets/css/genericons/genericons.css', array(), null, 'all' ); wp_enqueue_script( 'jquery-masonry' ); wp_enqueue_script( 'mahala-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array( 'jquery' ), false, true ); wp_enqueue_script( 'amathambo-fitvids', get_template_directory_uri() . '/assets/js/jquery.fitvids.js', array( 'jquery' ), 'null', true ); wp_enqueue_script( 'amathambo-fitvids-init', get_template_directory_uri() . '/assets/js/fitvids-init.js', array( 'jquery' ), 'null', true ); wp_enqueue_script( 'amathambo-scroll-to-top', get_template_directory_uri() . '/assets/js/scroll-up.js', array( 'jquery' ), 'null', true ); wp_enqueue_script( 'amathambo-masonry-init', get_template_directory_uri() . '/assets/js/masonry-init.js', array( 'jquery' ), 'null', true ); wp_enqueue_script( 'amathambo-skip-link-focus-fix', get_template_directory_uri() . '/assets/js/skip-link-focus-fix.js', array(), null, true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'amathambo_scripts' ); } /** * Enqueue WordPress theme styles within Gutenberg. */ function amathambo_gutenberg_styles() { // Load the theme styles within Gutenberg. wp_enqueue_style( 'amathanbo-gutenberg', get_theme_file_uri( '/assets/css/gutenberg.css' ), false ); } add_action( 'enqueue_block_editor_assets', 'amathambo_gutenberg_styles' ); /** * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Functions which enhance the theme by hooking into WordPress. */ require get_template_directory() . '/inc/template-functions.php'; /** * Customizer additions. */ require get_template_directory() . '/inc/customizer.php'; /** * Load Jetpack compatibility file. */ if ( defined( 'JETPACK__VERSION' ) ) { require get_template_directory() . '/inc/jetpack.php'; } /** * Text Radio Customizer Control Class. */ require get_template_directory() . '/inc/class-amathambo-text-radio-button-control.php'; /** * Popular Posts widget. */ require get_template_directory() . '/assets/widgets/class-amathambo-popular-posts.php'; /** * Recent Posts widget. */ require get_template_directory() . '/assets/widgets/class-amathambo-recent-posts.php'; /** * Featured Posts widget. */ require get_template_directory() . '/assets/widgets/class-amathambo-featured-posts.php';