get_setting( 'blogname' )->transport = 'postMessage'; $wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage'; $wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage'; } add_action( 'customize_register', 'arche_customize_register' ); // b. Queues JavaScript postMessage handlers for use within the Customizer interface function arche_customize_preview_js() { wp_enqueue_script( 'arche-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '2016', true ); } add_action( 'customize_preview_init', 'arche_customize_preview_js' ); // c. Function that adds theme options to the WordPress customisier if ( ! function_exists( 'arche_customisation' ) ) { get_template_part( 'customise' ); } // Function required for using hooks within the theme - make sure it's not defined elsewhere first if ( ( ! function_exists( 'get_arche_hook' ) ) && ( ! function_exists( 'the_arche_hook' ) ) ) { // Function that checks to see if the hook exists or not (used for inline hooks) function get_arche_hook( $get_hook_name, $get_hook_location, $get_hook_ext ) { // Check if hooks are turned on or not within the theme if ( get_theme_mod('arche_theme_setting_hooks') ) { // Define the variables we use within the function $the_hook_name = $get_hook_name; $the_hook_location = $get_hook_location; $the_hook_ext = $get_hook_ext; // Now we need to see if the hook has been properly defined through the function if ( ($the_hook_name != NULL) || ($the_hook_location != NULL) || ($the_hook_ext != NULL) ) { // Check if the file (hook) exists so we can include it if ( file_exists(get_template_directory() . "/hooks/" . $the_hook_name . "." . $the_hook_location . "." . $the_hook_ext) ) { // The hook exists, return a value of true return true; } else { // The hook doesn't exist so return a false value return false; } } else { // The hook was properly defined so return false return false; } } else { // Hooks have been disabled so stop the function return false; } } // Function that includes any hooks in the theme templates function the_arche_hook( $get_hook_name, $get_hook_location, $get_hook_ext ) { // Check if hooks are turned on or not within the theme if ( get_theme_mod('arche_theme_setting_hooks') ) { // Define the variables we use within the function $the_hook_name = $get_hook_name; $the_hook_location = $get_hook_location; $the_hook_ext = $get_hook_ext; // Now we need to see if the hook has been properly defined through the function if ( ($the_hook_name != NULL) || ($the_hook_location != NULL) || ($the_hook_ext != NULL) ) { // Check if the file (hook) exists so we can include it if ( file_exists(get_template_directory() . "/hooks/" . $the_hook_name . "." . $the_hook_location . "." . $the_hook_ext) ) { // The hook exists, define the hook path $hook_file = get_template_directory() . "/hooks/" . $the_hook_name . "." . $the_hook_location . "." . $the_hook_ext; // Then include the hook in our template include($hook_file); return true; } else { // The hook doesn't exist so return a false value return false; } } else { // The hook was properly defined so return false return false; } } else { // Hooks have been disabled so stop the function return false; } } } // Function that removes the protected text from a post/page title function arche_title_rewrite( $content ) { // Return the title with no other text return '%s'; } add_filter( 'private_title_format', 'arche_title_rewrite' ); add_filter( 'protected_title_format', 'arche_title_rewrite' ); // Function that redesigns the password protected post form function arche_protected_post_form() { // We're using the global post variable for this global $post; // Set up the form elements now $label = 'pwbox-'.( empty( $post->ID ) ? rand() : $post->ID ); if ( get_arche_hook('theme_protected_form', 'inline', 'php') ) { the_arche_hook('theme_protected_form', 'inline', 'php'); } else { $ppwform = '
' . _e( '

Just a moment...

', 'arche' ) . ' ' . _e('

This post is password protected. You need to enter a password before you can read the content.

', 'arche') . '
'; } // Return the form onto the page return $ppwform; } add_filter( 'the_password_form', 'arche_protected_post_form' ); // Function to include the Google Fonts API for Lato function arche_get_font_url() { $font_url = ''; // Translation fallback for unsupported characters if ( 'off' !== _x( 'on', 'Lato font: on or off', 'arche' ) ) { $subsets = 'latin,latin-ext'; $query_args = array( 'family' => 'Lato:400,100,300,700', 'subset' => $subsets, ); $font_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); } return $font_url; } // Queue all the scripts and styles for the front-end please function arche_scripts_styles() { global $wp_styles; // Add in JS for threaded comment support if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } // Adds JavaScript for handling the navigation menu hide-and-show behavior. wp_enqueue_script( 'arche-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '2016', true ); // Create the font URL to include the Google Fonts API $font_url = arche_get_font_url(); if ( ! empty( $font_url ) ) { wp_enqueue_style( 'arche-fonts', esc_url_raw( $font_url ), array(), null ); } // Include and load the main theme stylesheet wp_enqueue_style( 'arche-style', get_stylesheet_uri() ); // Include and load the stylesheet for Material Icons wp_enqueue_style( 'arche-md-style', get_stylesheet_directory_uri() . '/css/material-icons.css' ); // Includes and loads an additional Stylesheet for use within the theme if ( get_arche_hook( 'theme_style', 'inline', 'css' ) ) { wp_enqueue_style( 'arche-ts-style', get_stylesheet_directory_uri() . '/hooks/theme_style.inline.css' ); } // Includes and laods an additional JavaScript for use within the theme if ( get_arche_hook( 'theme_script', 'inline', 'js' ) ) { wp_enqueue_script( 'arche-ts-style', get_stylesheet_directory_uri() . '/hooks/theme_script.inline.js' ); } } add_action( 'wp_enqueue_scripts', 'arche_scripts_styles' ); // Check to see if the theme has the custom wp-login page if ( get_theme_mod('arche_theme_setting_login') ) { // First thing is to make sure our customisations are setup and ready function arche_login_design() { echo ''; echo ''; } function arche_login_url() { return home_url(); } function arche_login_title() { return get_bloginfo('name'); } // Last thing is to call our actions and filters to make our login page look nice add_action( 'login_enqueue_scripts', 'arche_login_design' ); add_filter( 'login_headerurl', 'arche_login_url' ); add_filter( 'login_headertitle', 'arche_login_title' ); } // Include extra gubbins for the TinyMCE editor to supercharge it function arche_mce_css( $mce_css ) { $font_url = arche_get_font_url(); if ( empty( $font_url ) ) return $mce_css; if ( ! empty( $mce_css ) ) $mce_css .= ','; $mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) ); return $mce_css; } add_filter( 'mce_css', 'arche_mce_css' ); // Build the page title and description for our page function arche_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) { return $title; } // Add the site name $title .= get_bloginfo( 'name', 'display' ); // Add the site description for the home/front page $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title = "$title $sep $site_description"; } // Add a page number if necessary if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title = "$title $sep " . sprintf( __( 'Page %s', 'arche' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'arche_wp_title', 10, 2 ); // Make the wp_page_menu() function include a home link function arche_page_menu_args( $args ) { if ( ! isset( $args['show_home'] ) ) $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'arche_page_menu_args' ); // Register all of the sidebars that we may wish to use function arche_widgets_init() { // Defined as sidebar.php register_sidebar( array( 'name' => __( 'Sidebar One', 'arche' ), 'id' => 'sidebar-one', 'description' => __( 'Sidebar One appears on all main pages such as the homepage, category and search pages.', 'arche' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Defined as sidebar-secondary.php register_sidebar( array( 'name' => __( 'Sidebar Two', 'arche' ), 'id' => 'sidebar-two', 'description' => __( 'Sidebar Two appears on all post and page content pages.', 'arche' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); // Defined as sidebar-tertiary.php register_sidebar( array( 'name' => __( 'Sidebar Three', 'arche' ), 'id' => 'sidebar-three', 'description' => __( 'Sidebar Three appears on all unique, special template pages and posts.', 'arche' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'arche_widgets_init' ); if ( ! function_exists( 'arche_content_nav' ) ) { // Includes a next and previous button for pages with pagination function arche_content_nav( $html_id ) { global $wp_query; if ( $wp_query->max_num_pages > 1 ) : ?> comment_type ) : case 'pingback' : case 'trackback' : ?>
  • id="comment-">

    ', '' ); ?>

  • id="li-comment-">
    user_id === $post->post_author ) ? __( 'Post Author', 'arche' ) : '' ); ?>
    today ', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), sprintf( __( '%1$s at %2$s', 'arche' ), get_comment_date(), get_comment_time() ) ); ?>
    comment_approved ) : ?>
    assistant_photo Your comment is awaiting moderation.', 'arche' ); ?>
    __( 'Reply', 'arche' ), 'after' => '', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    ', esc_url( get_permalink() ), esc_attr( get_the_time() ), esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date() ) ); $author = sprintf( '', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'arche' ), get_the_author() ) ), get_the_author() ); if ( $tag_list ) { $utility_text = __( 'Posted in %1$s and tagged %2$s on %3$s by %4$s.', 'arche' ); } elseif ( $categories_list ) { $utility_text = __( 'Posted in %1$s on %3$s by %4$s.', 'arche' ); } else { $utility_text = __( 'Posted on %3$s by %4$s.', 'arche' ); } printf( $utility_text, $categories_list, $tag_list, $date, $author ); } } // Extends the body classes depending on the theme setup function arche_body_class( $classes ) { // Return the default classes, we don't need to add anything else here return $classes; } add_filter( 'body_class', 'arche_body_class' ); /* END OF FUNCTIONS - - - - - - - - - - - - - - - - - - - - */