960, 'height' => 100, 'flex-height' => true, 'uploads' => true )); add_theme_support( 'custom-background' ); function parseh_setup() { add_editor_style(); } add_action( 'after_setup_theme', 'parseh_setup' ); /** * Load theme translations. * * Translations can be filed in the /languages/ directory. If you're * building a theme based on parseh, use a find and replace to change * 'parseh' to the name of your theme in all the template files. * * @link https://codex.wordpress.org/Function_Reference/load_theme_textdomain * @since 1.0.0 */ function parseh_lang_setup(){ load_theme_textdomain( 'parseh', get_template_directory() . '/languages' ); } add_action( 'after_setup_theme', 'parseh_lang_setup' ); /** * Load deprecated hooks and functions for this theme. * * @since 1.6.0 */ require_once get_template_directory() . '/inc/compat/deprecated.php'; /** * Load functions for handling special child theme compatibility conditions. * * @since 1.6.0 */ require_once get_template_directory() . '/inc/compat/child-themes.php'; /** * Load custom helper functions for this theme. * * @since 1.0.0 */ require_once get_template_directory() . '/inc/helpers.php'; /** * Load custom template tags for this theme. * * @since 1.0.0 */ require_once get_template_directory() . '/inc/template-tags.php'; /** * Load template parts and override some WordPress defaults. * * @since 1.0.0 */ require_once get_template_directory() . '/inc/hooks.php'; /** * Reset the transient for the active categories check. * * @action create_category * @action edit_category * @action delete_category * @action save_post * @see parseh_has_active_categories() * @since 1.0.0 */ function parseh_has_active_categories_reset() { delete_transient( 'parseh_has_active_categories' ); } add_action( 'create_category', 'parseh_has_active_categories_reset' ); add_action( 'edit_category', 'parseh_has_active_categories_reset' ); add_action( 'delete_category', 'parseh_has_active_categories_reset' ); add_action( 'save_post', 'parseh_has_active_categories_reset' ); /** * * Setting search field on the header. * */ function register_main_menu() { register_nav_menu('main-menu',_( 'Main Menu' )); } add_action( 'init', 'register_main_menu' ); add_filter('wp_nav_menu_items', 'add_search_form', 10, 2); function add_search_form($items, $args) { if( $args->theme_location == 'main-menu' ) $items .= ''; return $items; } /** * * Setting logo size. * */ function register_footer_menu() { register_nav_menu('footer-menu',_( 'Footer Menu' )); } add_action( 'init', 'register_footer_menu' ); function parseh_custom_logo_setup() { $defaults = array( 'height' => 48, 'width' => 106, 'flex-height' => true, 'flex-width' => true, 'header-text' => array( 'navbar-brand', 'site-description' ), ); add_theme_support( 'custom-logo', $defaults ); } add_action( 'after_setup_theme', 'parseh_custom_logo_setup' ); /** * Enable support for Post Thumbnails on posts and pages. * * @link https://developer.wordpress.org/reference/functions/add_theme_support/#post-thumbnails * @since 1.0.0 */ add_theme_support( 'post-thumbnails' ); /** * Enable support for Automatic Feed Links. * * @link https://codex.wordpress.org/Automatic_Feed_Links * @since 1.0.0 */ add_theme_support( 'automatic-feed-links' ); /** * Enable widgets for footer site. * * @since 1.0.0 */ add_action( 'init', 'init_parseh_child' ); function init_parseh_child() { remove_action( 'widgets_init', 'parseh_widgets_init' ); add_action( 'widgets_init', 'new_parseh_widgets_init', 0 ); } if (function_exists('register_sidebar')) { register_sidebar( array( 'name' => 'Footer One', 'id' => 'footerone', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar( array( 'name' => 'Footer Two', 'id' => 'footertwo', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); register_sidebar($args = array( 'name' => 'Footer Three', 'id' => 'footerthree', 'description' => '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } /** * Add .js script if "Enable threaded comments" is activated in Admin * Codex: {@link https://developer.wordpress.org/reference/functions/wp_enqueue_script/} */ function parseh_enqueue_comments_reply() { if( is_singular() && comments_open() && ( get_option( 'thread_comments' ) == 1) ) { // Load comment-reply.js (into footer) wp_enqueue_script( 'comment-reply', 'wp-includes/js/comment-reply', array(), false, true ); } } add_action( 'wp_enqueue_scripts', 'parseh_enqueue_comments_reply' ); function parseh_comment_form_default_fields( $fields ) { $commenter = wp_get_current_commenter(); $user = wp_get_current_user(); $user_identity = $user->exists() ? $user->display_name : ''; $req = get_option( 'require_name_email' ); $aria_req = ( $req ? " aria-required='true'" : '' ); $html_req = ( $req ? " required='required'" : '' ); $html5 = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : false; $fields = [ 'author' => '

' . '
' . '

', 'email' => '


' . '

', 'url' => '


' . '

', 'comment_field' => '


', ]; return $fields; } add_filter( 'comment_form_default_fields', 'parseh_comment_form_default_fields' ); /** * Sets the content width in pixels, based on the theme layout. * * Priority 0 to make it available to lower priority callbacks. * * @action after_setup_theme * @global int $content_width * @since 1.0.0 */ function parseh_content_width() { $layout = parseh_get_layout(); $content_width = ( 'one-column-wide' === $layout ) ? 1068 : 688; /** * Filter the content width in pixels. * * @since 1.0.0 * * @param string $layout * * @var int */ $GLOBALS['content_width'] = (int) apply_filters( 'parseh_content_width', $content_width, $layout ); } add_action( 'after_setup_theme', 'parseh_content_width', 0 ); function parseh_comment_form_defaults( $defaults ) { if ( isset( $defaults[ 'comment_field' ] ) ) { $defaults[ 'comment_field' ] = ''; } return $defaults; } add_filter( 'comment_form_defaults', 'parseh_comment_form_defaults', 10, 1 ); add_action( 'set_comment_cookies', function( $comment, $user ) { setcookie( 'ta_comment_wait_approval', '1', 0, '/' ); }, 10, 2 ); add_action( 'init', function() { if( isset( $_COOKIE['ta_comment_wait_approval'] ) && $_COOKIE['ta_comment_wait_approval'] === '1' ) { setcookie( 'ta_comment_wait_approval', '0', 0, '/' ); add_action( 'comment_form_before', function() { echo "

Your comment has been sent successfully.

"; }); } }); add_filter( 'comment_post_redirect', function( $location, $comment ) { $location = get_permalink( $comment->comment_post_ID ) . '#wait_approval'; return $location; }, 10, 2 ); function parseh_filter_wp_title( $title ) { if ( is_single() || ( is_home() && !is_front_page() ) || ( is_page() && !is_front_page() ) ) { $title = single_post_title( '', false ); } if ( is_front_page() && ! is_page() ) { $title = esc_attr( get_bloginfo( 'name' ) ); } return $title; } add_filter( 'wp_title', 'parseh_filter_wp_title' ); add_action('wp_enqueue_scripts', 'cssmenumaker_scripts_styles' ); function cssmenumaker_scripts_styles() { wp_enqueue_style( 'cssmenu-styles', get_template_directory_uri() . '/style.css'); } require_once get_template_directory() . '/inc/navigator.php'; function lnk_register_theme_customizer( $wp_customize ) { $wp_customize->add_setting( 'tcx_link_color', array( 'default' => '#000000', 'sanitize_callback' => 'sanitize_hex_color' ) ); $wp_customize->add_control( new WP_Customize_Color_Control( $wp_customize, 'link_color', array( 'label' => __( 'Link Color', 'parseh' ), 'section' => 'colors', 'settings' => 'tcx_link_color' ) ) ); } add_action( 'customize_register', 'lnk_register_theme_customizer' ); function lnk_customizer_css() { ?>