max_num_pages < 2 ) { return; } ?> 'Sidebar Widgets', 'id' => 'sidebar-widgets', 'description' => __('Drag widget for the sidebar here','a11yall'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' )); register_sidebar( array( 'name' => 'Page Sidebar', 'id' => 'page-widgets', 'description' => __('Drag to create or update the sidebar for pages','a11yall'), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' )); } add_action( 'widgets_init', 'a11yall_widgets_init' ); // Start Theme Setup. // Run a11yall_themesetup() to make various things possible when the 'after_setup_theme' hook is run. add_action('after_setup_theme', 'a11yall_themesetup'); function a11yall_themesetup() { // Styling the visual admin editor to resemble the theme style add_editor_style( 'css/editor-style.css'); global $content_width; // Set oEmbed max width for things like videos if ( ! isset( $content_width ) ) { $content_width = 600; /* pixels */ } // Make theme available for translation // Translations can be filed in the /languages/ directory. load_theme_textdomain( 'a11yall', get_template_directory() . '/languages' ); // Adds RSS feed links to for posts and comments. add_theme_support( 'automatic-feed-links' ); // Setup the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'a11yall_custom_background_args', array( 'default-color' => 'dddddd', 'default-image' => '', ) ) ); // Set up Featured Images (formerly known as post thumbnails) add_theme_support( 'post-thumbnails' ); // Adding title tag theme support per https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ add_theme_support( 'title-tag' ); // Register menus register_nav_menus( array( 'primary' => __( 'Main Menu', 'a11yall' ), 'secondary' => __( 'Footer Menu', 'a11yall' ) ) ); register_default_headers( array( 'wheel' => array( 'url' => '%s/img/header.png', 'thumbnail_url' => '%s/img/header.png', 'description' => __( 'Pinwheel', 'a11yall' ) ), 'dancing-flower-aqua' => array( 'url' => '%s/img/dancing-flower-aqua.png', 'thumbnail_url' => '%s/img/dancing-flower-aqua.png', 'description' => __( 'Aqua Dancing Flower', 'a11yall' ) ), 'dancing-flower-terracotta' => array( 'url' => '%s/img/dancing-flower-terracotta.png', 'thumbnail_url' => '%s/img/dancing-flower-terracotta.png', 'description' => __( 'Terra Dancing Flower', 'a11yall' ) ) ) ); // Add custom header support $header_defaults = array( 'default-image' => '', 'random-default' => false, 'width' => 125, 'height' => 125, 'flex-height' => false, 'flex-width' => false, 'default-text-color' => '', 'header-text' => false, 'uploads' => true ); add_theme_support( 'custom-header', $header_defaults ); } // End Theme Setup // For WP versions older than 4.1 supply a title tag if ( version_compare( $GLOBALS['wp_version'], '4.1', '<' ) ) : /** * Filters wp_title to print a neat tag based on what is being viewed. * * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function a11yall_wp_title( $title, $sep ) { if ( is_feed() ) { return $title; } global $page, $paged; // Add the blog name $title .= get_bloginfo( 'name', 'display' ); // Add the blog description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title .= " $sep $site_description"; } // Add a page number if necessary: if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) { $title .= " $sep " . sprintf( __( 'Page %s', 'a11yall' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'a11yall_wp_title', 10, 2 ); /** * Title shim for sites older than WordPress 4.1. * * @link https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ * @todo Remove this function when WordPress 4.3 is released. */ function a11yall_render_title() { ?> <title><?php wp_title( '|', true, 'right' ); ?> '; } // Remove double spaces function a11yall_remove_spaces($the_content) { return preg_replace( '/[\p{Z}\s]{2,}/u', ' ', $the_content ); } add_filter('the_content', 'a11yall_remove_spaces'); // Make so null search does not take user back to home page function a11yall_my_request_filter( $query_vars ) { if( isset( $_GET['s'] ) && empty( $_GET['s'] ) ) { $query_vars['s'] = " "; } return $query_vars; } add_filter( 'request', 'a11yall_my_request_filter' ); // No Sidebar Option // Makes it possible to have posts that have no sidebar; // Requires use of a custom field called NoSidebar that is set to true function load_single_template($template) { $new_template = ''; // single post template if( is_single() ) { global $post; //if post has a custom field called disableSidebar and it's set to true: $disableSidebar = get_post_meta($post->ID, 'NoSidebar', $single = true); if ($disableSidebar == 'true') { // use template file single-template-cat-1.php $new_template = locate_template(array('post-nosidebar.php' )); } } return ('' != $new_template) ? $new_template : $template; } add_action('template_include', 'load_single_template');