From f7d09ea8d9f087f5df7b9298a29afbee21da53d8 Mon Sep 17 00:00:00 2001 From: Ben Brehaut Date: Sat, 10 Dec 2016 23:21:57 +0000 Subject: [PATCH] Launch of theme --- .gitignore | 15 ++++ 404.php | 28 +++++++ Gruntfile.js | 100 ++++++++++++++++++++++ README.md | 37 +++++++++ archive.php | 36 ++++++++ assets/css/style.css | 2 + assets/js/main.js | 10 +++ assets/js/scripts.js | 10 +++ assets/js/scripts.min.js | 1 + assets/scss/style.scss | 11 +++ comments.php | 79 ++++++++++++++++++ footer.php | 37 +++++++++ functions.php | 33 ++++++++ header.php | 53 ++++++++++++ index.php | 34 ++++++++ lib/cleanup.php | 62 ++++++++++++++ lib/enqueue-scripts.php | 35 ++++++++ lib/navigation.php | 132 ++++++++++++++++++++++++++++++ lib/relative-theme-assets.php | 84 +++++++++++++++++++ lib/theme-custom.php | 34 ++++++++ lib/wp-base.php | 77 +++++++++++++++++ package.json | 36 ++++++++ page.php | 34 ++++++++ search.php | 22 +++++ searchform.php | 22 +++++ sidebar.php | 18 ++++ single.php | 26 ++++++ style.css | 20 +++++ template-parts/featured-image.php | 19 +++++ template-parts/post.php | 9 ++ template-parts/site-logo.php | 12 +++ 31 files changed, 1128 insertions(+) create mode 100644 .gitignore create mode 100644 404.php create mode 100644 Gruntfile.js create mode 100644 README.md create mode 100644 archive.php create mode 100644 assets/css/style.css create mode 100644 assets/js/main.js create mode 100644 assets/js/scripts.js create mode 100644 assets/js/scripts.min.js create mode 100644 assets/scss/style.scss create mode 100644 comments.php create mode 100644 footer.php create mode 100644 functions.php create mode 100644 header.php create mode 100644 index.php create mode 100644 lib/cleanup.php create mode 100644 lib/enqueue-scripts.php create mode 100644 lib/navigation.php create mode 100644 lib/relative-theme-assets.php create mode 100644 lib/theme-custom.php create mode 100644 lib/wp-base.php create mode 100644 package.json create mode 100644 page.php create mode 100644 search.php create mode 100644 searchform.php create mode 100644 sidebar.php create mode 100644 single.php create mode 100644 style.css create mode 100644 template-parts/featured-image.php create mode 100644 template-parts/post.php create mode 100644 template-parts/site-logo.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fea6d16 --- /dev/null +++ b/.gitignore @@ -0,0 +1,15 @@ +.DS_Store +.DS_Store? +._* +.Spotlight-V100 +.Trashes +ehthumbs.db +Thumbs.db +*.log +.tmp/ +*.sql +*.sql.gz +.sass-cache/ +*.css.map +.vscode +node_modules/* diff --git a/404.php b/404.php new file mode 100644 index 0000000..f85bcd0 --- /dev/null +++ b/404.php @@ -0,0 +1,28 @@ + + +
+
+

404 - File not Found

+
+
+

The page you are looking for might have been removed, had its name changed or is unavailable.

+

If you are still stuck, please try some of these suggestions.

+ +
+
+ + + + + + + +
+ + +

+ +

+ +
    + 100, + 'style' => 'ol', + 'short_ping' => true, + 'reply_text' => __( 'Reply', 'halos' ), + ) ); + ?> +
+ + + +

+ + +
diff --git a/footer.php b/footer.php new file mode 100644 index 0000000..678fc39 --- /dev/null +++ b/footer.php @@ -0,0 +1,37 @@ + + + + + + + + + + diff --git a/functions.php b/functions.php new file mode 100644 index 0000000..3a72fc4 --- /dev/null +++ b/functions.php @@ -0,0 +1,33 @@ + diff --git a/header.php b/header.php new file mode 100644 index 0000000..398d61d --- /dev/null +++ b/header.php @@ -0,0 +1,53 @@ + section. + * + * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials + * + * @package WordPress + * @subpackage halos + * @since 1.0 + * @version 1.0 + */ + +?> + + class="no-js"> + + + + + + + + + +> + + + + + + +
diff --git a/index.php b/index.php new file mode 100644 index 0000000..1f54a73 --- /dev/null +++ b/index.php @@ -0,0 +1,34 @@ + + + + +remove_menu('customize'); +} +add_action( 'wp_before_admin_bar_render', 'remove_customize_link' ); + +?> diff --git a/lib/enqueue-scripts.php b/lib/enqueue-scripts.php new file mode 100644 index 0000000..ca58140 --- /dev/null +++ b/lib/enqueue-scripts.php @@ -0,0 +1,35 @@ + diff --git a/lib/navigation.php b/lib/navigation.php new file mode 100644 index 0000000..dc095a6 --- /dev/null +++ b/lib/navigation.php @@ -0,0 +1,132 @@ + __( 'Site Header Navigation', 'halos' ), + 'site-footer-nav' => __( 'Site Footer Navigation', 'halos' ) +) ); + +/* +* Sidebar Widgets +*/ + +function sidebar_widgets() { + register_sidebar( array( + 'name' => esc_html__( 'Sidebar', 'halos' ), + 'id' => 'sidebar-1', + 'description' => '', + 'before_widget' => '
', + 'after_widget' => '
', + 'before_title' => '

', + 'after_title' => '

', + ) ); +} +add_action( 'widgets_init', 'sidebar_widgets' ); + +/* +* Pagination +*/ +function pagination( $args = null ) { + + $defaults = array( + 'page' => null, + 'pages' => null, + 'range' => 2, + 'gap' => 3, + 'anchor' => 0, + 'before' => '', + 'nextpage' => '', + 'previouspage' => '', + 'echo' => 1 + ); + + $r = wp_parse_args( $args, $defaults ); + extract( $r, EXTR_SKIP ); + + if ( !$page && !$pages ) { + global $wp_query; + + $page = get_query_var('paged'); + $page = !empty($page) ? intval($page) : 1; + + $posts_per_page = intval(get_query_var('posts_per_page')); + $pages = intval(ceil($wp_query->found_posts / $posts_per_page)); + } + + $output = ""; + if ($pages > 1) { + $output .= "$before"; + $ellipsis = "
  • ...
  • "; + + if ($page > 1 && !empty($previouspage)) { + $output .= "
  • < Prev
  • "; + } + + $min_links = $range * 2 + 1; + $block_min = min($page - $range, $pages - $min_links); + $block_high = max($page + $range, $min_links); + $left_gap = (($block_min - $anchor - $gap) > 0) ? true : false; + $right_gap = (($block_high + $anchor + $gap) < $pages) ? true : false; + + if ($left_gap && !$right_gap) { + $output .= sprintf('%s%s%s', + ti_paginate_loop(1, $anchor), + $ellipsis, + ti_paginate_loop($block_min, $pages, $page) + ); + } + else if ($left_gap && $right_gap) { + $output .= sprintf('%s%s%s%s%s', + ti_paginate_loop(1, $anchor), + $ellipsis, + ti_paginate_loop($block_min, $block_high, $page), + $ellipsis, + ti_paginate_loop(($pages - $anchor + 1), $pages) + ); + } + else if ($right_gap && !$left_gap) { + $output .= sprintf('%s%s%s', + ti_paginate_loop(1, $block_high, $page), + $ellipsis, + ti_paginate_loop(($pages - $anchor + 1), $pages) + ); + } + else { + $output .= ti_paginate_loop(1, $pages, $page); + } + + if ($page < $pages && !empty($nextpage)) { + $output .= "
  • Next >
  • "; + } + + $output .= $after; + } + + if ($echo) { + echo $output; + } + + return $output; +} + +function paginate_loop($start, $max, $page = 0) { + $output = ""; + for ($i = $start; $i <= $max; $i++) { + $output .= ($page === intval($i)) + ? "
  • $i
  • " + : "
  • $i
  • "; + } + return $output; +} diff --git a/lib/relative-theme-assets.php b/lib/relative-theme-assets.php new file mode 100644 index 0000000..0d584da --- /dev/null +++ b/lib/relative-theme-assets.php @@ -0,0 +1,84 @@ +make_protocol_relative_url( $src ); + } + /** + * Transform Enqueued JavaScript URLs + * + * @access public + * @return string + * @since 1.0 + */ + public function script_loader_src( $src, $handle ) { + return $this->make_protocol_relative_url( $src ); + } + /** + * Transform Enqueued Theme Files + * + * @access public + * @return string + * @since 1.0 + * @link http://codex.wordpress.org/Function_Reference/get_template_directory_uri + */ + public function template_directory_uri( $template_dir_uri, $template, $theme_root_uri ) { + return $this->make_protocol_relative_url( $template_dir_uri ); + } + /** + * Transform Enqueued Theme Files + * + * @access public + * @return string + * @since 1.0 + * @link http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri + */ + public function stylesheet_directory_uri( $stylesheet_dir_uri, $stylesheet, $theme_root_uri ) { + return $this->make_protocol_relative_url( $stylesheet_dir_uri ); + } + } + $protocol_relative_theme_assets = new Protocol_Relative_Theme_Assets; +endif; diff --git a/lib/theme-custom.php b/lib/theme-custom.php new file mode 100644 index 0000000..a9f18f7 --- /dev/null +++ b/lib/theme-custom.php @@ -0,0 +1,34 @@ +` element when JavaScript is detected. +*/ +function js_detection() { + echo "\n"; +} +add_action( 'wp_head', 'js_detection', 0 ); + +/** +* Add ACF theme Settings to WP +*/ +if( function_exists('acf_add_options_page') ) { + + $option_page = acf_add_options_page(array( + 'page_title' => 'Theme Settings', + 'menu_title' => 'Theme Settings', + 'menu_slug' => 'theme-settings', + 'capability' => 'edit_posts', + 'redirect' => false + )); + +} diff --git a/lib/wp-base.php b/lib/wp-base.php new file mode 100644 index 0000000..848065b --- /dev/null +++ b/lib/wp-base.php @@ -0,0 +1,77 @@ + tag in the document head, and expect WordPress to + * provide it for us. + */ + add_theme_support( 'title-tag' ); + + /* + * Menu Support + */ + add_theme_support( 'menus' ); + + /* + * Declare WooCommerce support + * http://docs.woothemes.com/document/third-party-custom-theme-compatibility/ + */ + add_theme_support( 'woocommerce' ); + + /* + * 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' ); + + /* + * RSS thing.. + */ + add_theme_support( 'automatic-feed-links' ); + + /* + * Enable support for Post Formats + * This has been commented out as it is not used for many projects + * + * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ + */ + /* + add_theme_support( 'post-formats', array( + 'aside', + 'gallery' + ) ); + */ + + /* + * 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', + ) ); +} +add_action( 'after_setup_theme', 'wp_base_setup' ); + +?> diff --git a/package.json b/package.json new file mode 100644 index 0000000..3511bd9 --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "halos", + "version": "1.0.0", + "description": "A base starter theme for custom theme development on WordPress project builds.", + "main": "index.php", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "https://github.com/benbrehaut/halos/" + }, + "keywords": [ + "wordpress", + "front-end", + "back-end", + "php", + "css", + "scss", + "js", + "jquery", + "halo" + ], + "author": "Ben Brehaut", + "license": "MIT", + "devDependencies": { + "autoprefixer": "^6.5.3", + "grunt": "^1.0.1", + "grunt-contrib-concat": "^1.0.1", + "grunt-contrib-uglify": "^2.0.0", + "grunt-contrib-watch": "^1.0.0", + "grunt-postcss": "^0.8.0", + "grunt-sass": "^1.2.1", + "time-grunt": "^1.4.0" + } +} diff --git a/page.php b/page.php new file mode 100644 index 0000000..1f54a73 --- /dev/null +++ b/page.php @@ -0,0 +1,34 @@ + + + + + + + + +

    You search for:

    + + + + + + + + + + diff --git a/sidebar.php b/sidebar.php new file mode 100644 index 0000000..a112047 --- /dev/null +++ b/sidebar.php @@ -0,0 +1,18 @@ + + + diff --git a/single.php b/single.php new file mode 100644 index 0000000..e7e4d00 --- /dev/null +++ b/single.php @@ -0,0 +1,26 @@ + + + +
    > +
    + +
    +
    + +
    + +
    + + + +ID ) ) : + $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'single-post-thumbnail' ); + $image = $image[0]; ?> + +
    '; + diff --git a/template-parts/post.php b/template-parts/post.php new file mode 100644 index 0000000..843ef7f --- /dev/null +++ b/template-parts/post.php @@ -0,0 +1,9 @@ + diff --git a/template-parts/site-logo.php b/template-parts/site-logo.php new file mode 100644 index 0000000..8c87360 --- /dev/null +++ b/template-parts/site-logo.php @@ -0,0 +1,12 @@ + + +

    Site Logo