├── .DS_Store ├── README.md ├── css ├── normalize.css └── variables.css ├── footer.php ├── functions.php ├── header.php ├── img ├── error.png ├── placeholder.png ├── unsplash-1.jpg ├── unsplash-2.jpg ├── unsplash-3.jpg └── unsplash-4.jpg ├── inc ├── ajax.php ├── post-types.php ├── spa.php └── theme-image.php ├── index.php ├── js ├── ajax.js ├── main.js └── spa.js ├── screenshot.png ├── style.css └── templates ├── page-ajax.php └── page-spa.php /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidcreature/zero_wp/919bb79737af0b3176983723e6c87cf69f33a851/.DS_Store -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zero WP 3.5 2 | Ultra-minimal WordPress starter theme. Optimized for converting html-layouts to websites, single page applications, non-standard functionality. 3 | 4 | Features 5 | ======== 6 | 7 | * Based of native WordPress functions and logic 8 | * Minimal set of theme files 9 | * Uses JS-fix for screen height on mobile devices 10 | * Includes Custom Post Types & Custom taxonomies 11 | * Handy function for static images 12 | * Selective on/off Gutenberg for different post types 13 | * Basic SPA example with page template 14 | * Basic AJAX example with page template 15 | -------------------------------------------------------------------------------- /css/normalize.css: -------------------------------------------------------------------------------- 1 | * { 2 | box-sizing: border-box; 3 | } 4 | 5 | body { 6 | margin: 0; 7 | } 8 | 9 | img { 10 | max-width: 100%; 11 | height: auto; 12 | } -------------------------------------------------------------------------------- /css/variables.css: -------------------------------------------------------------------------------- 1 | :root { 2 | /* Layout */ 3 | --content-width: 992px; 4 | 5 | /* Colors */ 6 | --c-main: #2D2D2D; 7 | --c-secondary: #888888; 8 | --c-accent: #FF9800; 9 | --c-footer: #111; 10 | --c-text: #111; 11 | --c-background: #e6e6e6; 12 | --c-link: #cc7a00; 13 | --c-link-hover: #ffad33; 14 | --c-link-visited: #cc7a00; 15 | 16 | /* Font Styles */ 17 | --font-main: 'Arial', sans-serif; 18 | --font-secondary: 'Georgia', serif; 19 | --size-h1: 42px; 20 | --lh-h1: 1.2; 21 | --size-h2: 32px; 22 | --lh-h2: 1.4; 23 | --size-h3: 28px; 24 | --lh-h3: 1.4; 25 | --size-h4: 22px; 26 | --lh-h4: 1.4; 27 | --size-text: 18px; 28 | --lh-text: 1.4; 29 | } -------------------------------------------------------------------------------- /footer.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | 2 | > 3 | 4 | 5 | 6 | 7 | 8 | > -------------------------------------------------------------------------------- /img/error.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidcreature/zero_wp/919bb79737af0b3176983723e6c87cf69f33a851/img/error.png -------------------------------------------------------------------------------- /img/placeholder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidcreature/zero_wp/919bb79737af0b3176983723e6c87cf69f33a851/img/placeholder.png -------------------------------------------------------------------------------- /img/unsplash-1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidcreature/zero_wp/919bb79737af0b3176983723e6c87cf69f33a851/img/unsplash-1.jpg -------------------------------------------------------------------------------- /img/unsplash-2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidcreature/zero_wp/919bb79737af0b3176983723e6c87cf69f33a851/img/unsplash-2.jpg -------------------------------------------------------------------------------- /img/unsplash-3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidcreature/zero_wp/919bb79737af0b3176983723e6c87cf69f33a851/img/unsplash-3.jpg -------------------------------------------------------------------------------- /img/unsplash-4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidcreature/zero_wp/919bb79737af0b3176983723e6c87cf69f33a851/img/unsplash-4.jpg -------------------------------------------------------------------------------- /inc/ajax.php: -------------------------------------------------------------------------------- 1 | $message]); 62 | wp_die(); 63 | } -------------------------------------------------------------------------------- /inc/post-types.php: -------------------------------------------------------------------------------- 1 | 'Genres', 11 | 'singular_name' => 'Genre', 12 | 'search_items' => 'Search Genres', 13 | 'all_items' => 'All Genres', 14 | 'view_item ' => 'View Genre', 15 | 'parent_item' => 'Parent Genre', 16 | 'parent_item_colon' => 'Parent Genre:', 17 | 'edit_item' => 'Edit Genre', 18 | 'update_item' => 'Update Genre', 19 | 'add_new_item' => 'Add New Genre', 20 | 'new_item_name' => 'New Genre Name', 21 | 'menu_name' => 'Genre', 22 | 'back_to_items' => '← Back to Genre', 23 | ); 24 | 25 | $args = array ( 26 | 'label' => 'Genres', 27 | 'labels' => $labels, 28 | 'description' => '', 29 | 'public' => true, 30 | 'hierarchical' => true, 31 | 'rewrite' => true, 32 | 'capabilities' => array(), 33 | 'show_admin_column' => true, 34 | ); 35 | 36 | /* Additional Parameters for $args 37 | 'publicly_queryable' => null, 38 | 'show_in_nav_menus' => true, 39 | 'show_ui' => true, 40 | 'show_in_menu' => true, 41 | 'show_tagcloud' => true, 42 | 'show_in_quick_edit' => null, 43 | 'query_var' => $taxonomy, 44 | '_builtin' => false, 45 | 'update_count_callback' => '_update_post_term_count', 46 | 'meta_box_cb' => null, 47 | 'show_in_rest' => null, 48 | 'rest_base' => null, 49 | */ 50 | 51 | $post_types = array('post'); 52 | 53 | register_taxonomy( 'taxonomy', [ 'post' ], $args ); 54 | } 55 | 56 | 57 | //Create new Custom Post Type 58 | function theme_register_post_types(){ 59 | 60 | $labels = array( 61 | 'name' => 'Quotes', 62 | 'singular_name' => 'Quote', 63 | 'add_new' => 'Add Quote', 64 | 'add_new_item' => 'Add New Quote', 65 | 'edit_item' => 'Edit Quote', 66 | 'new_item' => 'New Quote', 67 | 'view_item' => 'View Quote', 68 | 'search_items' => 'Search Quotes', 69 | 'not_found' => 'Not Found', 70 | 'not_found_in_trash' => 'Not Found in Trash', 71 | 'parent_item_colon' => '', 72 | 'menu_name' => 'Quotes', 73 | ); 74 | 75 | $args = array( 76 | 'label' => 'Quote', 77 | 'labels' => $labels, 78 | 'description' => '', 79 | 'public' => true, 80 | 'show_in_menu' => true, 81 | 'show_in_admin_bar' => true, 82 | 'menu_position' => null, 83 | 'menu_icon' => 'dashicons-format-quote', //https://developer.wordpress.org/resource/dashicons/ 84 | 'capability_type' => 'page', 85 | 'hierarchical' => false, 86 | 'supports' => ['title'], 87 | 'taxonomies' => [], 88 | 'has_archive' => false, 89 | 90 | ); 91 | 92 | /* Additional Parameters for $args 93 | 'publicly_queryable' => null, 94 | 'exclude_from_search' => null, 95 | 'show_ui' => null, 96 | 'show_in_nav_menus' => null, 97 | 'show_in_rest' => null, 98 | 'rest_base' => null, 99 | 'supports' => ['title','editor','author','thumbnail','excerpt','trackbacks','custom-fields','comments','revisions','page-attributes','post-formats'] 100 | 'capability_type' => 'post', 101 | 'capabilities' => 'post', 102 | 'map_meta_cap' => null, 103 | 'rewrite' => true, 104 | 'query_var' => true, 105 | */ 106 | 107 | register_post_type( 'quote', $args ); 108 | 109 | } -------------------------------------------------------------------------------- /inc/spa.php: -------------------------------------------------------------------------------- 1 | array( 'post', 'page'), 33 | 'posts_per_page' => 99, 34 | ); 35 | 36 | $query = new WP_Query( $args ); 37 | 38 | //WP_Query Loop 39 | while ( $query->have_posts() ) { 40 | $query->the_post(); 41 | global $post; 42 | $title = get_the_title(); 43 | $content = get_the_excerpt(); 44 | $photo = get_the_post_thumbnail_url($post->ID, 'large'); 45 | if (!$photo) { 46 | $i = random_int(1,4); 47 | $photo = theme_image('unsplash-' . $i . '.jpg', false); 48 | } 49 | 50 | $site_data[] = array('id' => $post->ID, 'post_type' => $post->post_type, 'title' => $title, 'content' => $content, 'photo' => $photo); 51 | } 52 | 53 | wp_reset_postdata(); 54 | 55 | return $site_data; 56 | } -------------------------------------------------------------------------------- /inc/theme-image.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |

6 |
7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /js/ajax.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | $(document).ready( function() { 3 | $('.js-ajax').click( function() { 4 | 5 | let current_time = Math.floor(Date.now() / 1000); 6 | 7 | $.ajax( { type:"post", url:ajax_url, dataType:"json", data:{ action:'sample_ajax_action', current_time:current_time } 8 | }).always( function( out ){ 9 | console.log(out); 10 | $( ".ajax-message" ).text( out.message ); 11 | }); 12 | return false; 13 | 14 | }); 15 | }); 16 | })( jQuery ); 17 | -------------------------------------------------------------------------------- /js/main.js: -------------------------------------------------------------------------------- 1 | //This snippet allows to have DIVs 100% screen height on mobile devices, use height: calc(100% * var(--vh)); in CSS 2 | 3 | let vh = window.innerHeight * 0.01; 4 | document.documentElement.style.setProperty('--vh', `${vh}px`); 5 | 6 | window.addEventListener('resize', () => { 7 | vh = window.innerHeight * 0.01; 8 | document.documentElement.style.setProperty('--vh', `${vh}px`); 9 | }); -------------------------------------------------------------------------------- /js/spa.js: -------------------------------------------------------------------------------- 1 | (function($) { 2 | 3 | $(document).ready( function() { 4 | let current_item = 0; 5 | 6 | $('.js-action').click( function() { 7 | if (typeof site_data !== 'undefined') { 8 | let posts_count = site_data.length - 1; 9 | 10 | $('.js-title').addClass("animate"); 11 | $('.js-title').html(site_data[current_item]['title']); 12 | $('.js-text').addClass("animate"); 13 | $('.js-text').html(site_data[current_item]['content']); 14 | $('.js-photo').attr('src', site_data[current_item]['photo']); 15 | 16 | setTimeout(()=> { 17 | $('.js-title').removeClass("animate"); 18 | $('.js-text').removeClass("animate"); 19 | }, 500); 20 | 21 | current_item++ 22 | 23 | if (current_item > posts_count) { 24 | current_item = 0; 25 | } 26 | 27 | $('.spa-message').text( site_data[current_item]['post_type'] + ' ID: ' + site_data[current_item]['id'] + ' is shown'); 28 | } 29 | 30 | else { 31 | alert('Error! Site Data is Undefined.'); 32 | } 33 | }); 34 | }); 35 | 36 | })( jQuery ); 37 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/solidcreature/zero_wp/919bb79737af0b3176983723e6c87cf69f33a851/screenshot.png -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | /* 2 | * Theme Name: Zero WP 3.0 3 | * Description: Ultra-minimal WordPress starter theme. Optimized for converting html-layouts to websites. Also is a good start for SPA, creating unique projects. 4 | * Theme URI: https://github.com/solidcreature/zero_wp 5 | * Author: Nikolay Mironov 6 | * Author URI: http://wpfolio.ru 7 | */ 8 | 9 | -------------------------------------------------------------------------------- /templates/page-ajax.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 96 | 97 |
98 | 99 | 100 | 101 |
102 | 103 |
104 |

AJAX Example

105 |

Just press a button

106 | 107 |
108 |
109 |
110 | 111 | 112 | 113 |
114 | 115 | 116 |
117 |

Error!

118 |

Remove // in functions.php on line 12
To make AJAX template works

119 |
120 | 121 |
122 | 123 | 124 | 125 | 126 |
127 | 128 | 129 | -------------------------------------------------------------------------------- /templates/page-spa.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 96 | 97 |
98 | 99 | 100 | 101 |
102 | 103 |
104 |

SPA Example

105 |

All Site Data is available in site_data variable in JS

106 | 107 |
108 |
109 |
110 | 111 | 112 | 113 |
114 | 115 | 116 |
117 |

Error!

118 |

Remove // in functions.php on line 11
To make SPA template works

119 |
120 | 121 |
122 | 123 | 124 | 125 | 126 |
127 | 128 | 129 | --------------------------------------------------------------------------------