├── screenshot.png
├── .editorconfig
├── style.css
├── README.md
├── functions.php
└── index.php
/screenshot.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/davidegreenwald/Bare-Minimum/HEAD/screenshot.png
--------------------------------------------------------------------------------
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 | [*]
3 | end_of_line = lf
4 | indent_style = space
5 | indent_size = 2
6 | charset = utf-8
7 | trim_trailing_whitespace = true
8 | insert_final_newline = true
9 |
--------------------------------------------------------------------------------
/style.css:
--------------------------------------------------------------------------------
1 | /*
2 | Theme Name: Bare Minimum
3 | Author: David Greenwald
4 | Author URI: https://www.davidgreenwald.com
5 | Description: A minimum viable product WordPress starter theme with no styles and strictly basic functionality.
6 | Version: 1.0
7 | License: GNU General Public License v2 or later
8 | License URI: http://www.gnu.org/licenses/gpl-2.0.html
9 |
10 | The goal of this theme is to serve as an educational project to see what it
11 | takes to get started on WordPress theme building.
12 | */
13 |
14 | /**
15 | * For the absolute bare minimum, WordPress can install a theme with a single
16 | * "Theme Name" comment header. A header must be provided before CSS begins.
17 | *
18 | * Above, this stylesheet has the practical minimum for non-Theme Directory use.
19 | *
20 | * I suggest getting started on your CSS with my reset/normalization stylesheet,
21 | * Setup.
22 | * https://github.com/davidegreenwald/css-setup
23 | */
24 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Bare Minimum
2 | ## A minimum viable product WordPress theme that's as simple as possible
3 |
4 | This is pretty close to the absolute bare minimum of what you would need to install a theme to publish WordPress content. I created it as a learning exercise to show how basic WordPress theme development can be.
5 |
6 | This theme can display single posts and pages, a homepage with posts, search results, a 404 page, and a sidebar and footer from a single index.php file.
7 |
8 | It does not have internationalization, custom post types, or other common features. Just the minimum code to get a theme off the ground.
9 |
10 | It needs some clean-up to match WordPress standards, so I'll be doing that next. It also needs page-to-page navigation and a couple of other actual features (but again, bare minimum).
11 |
12 | It has no CSS styles at all. Add some!
13 |
14 | Explore the files for documentation about why each part is necessary. You can use this as a from-scratch (seriously, from scratch) starter theme, add your own CSS, add more template files, whatever you want. Hope it helps. I'll be publishing a full walkthrough tutorial in the coming weeks.
--------------------------------------------------------------------------------
/functions.php:
--------------------------------------------------------------------------------
1 | 's
tag for SEO
30 | add_theme_support( 'title-tag' );
31 |
32 | // Add RSS feed links to the document
33 | add_theme_support( 'automatic-feed-links' );
34 |
35 | /**
36 | * Enable featured images (post thumbnails), commonly displayed on index,
37 | * archive, and blog pages and also used as the thumbnail image when sharing
38 | * to social media
39 | */
40 | add_theme_support( 'post-thumbnails' );
41 |
42 | /**
43 | * Update default WordPress core markup tags to modern HTML5 code for this
44 | * array of items - comments, search form, gallery images, photo captions
45 | */
46 | add_theme_support( 'html5', array(
47 | 'comment-list',
48 | 'comment-form',
49 | 'search-form',
50 | 'gallery',
51 | 'caption' )
52 | );
53 |
54 | /**
55 | * Add theme support for selective refresh for widgets to allow
56 | * Customizer editing without a full page reload.
57 | *
58 | * Not strictly "bare minimum" but basic and nice to have
59 | */
60 | add_theme_support( 'customize-selective-refresh-widgets' );
61 |
62 | /**
63 | * Other common functions you might add here:
64 | * Post formats (a la Tumblr style)
65 | * Content width
66 | * Custom Theme background (color or image)
67 | * Custom Header
68 | * Custom Logo
69 | * Additional image sizes
70 | */
71 | }
72 | add_action( 'after_setup_theme', 'bareminimum_setup' );
73 | } // don't forget to close the pluggable if statement
74 |
75 | /* =============================================================================
76 | #SCRIPTS - Enqueue styles and scripts
77 | */
78 |
79 | if ( ! function_exists( 'bareminimum_enqueue_scripts' ) ) {
80 | function bareminimum_enqueue_scripts() {
81 | // Load main stylesheet
82 | wp_enqueue_style( 'style', get_stylesheet_uri() );
83 |
84 | // naturally we can load jQuery and any other scripts from here
85 | }
86 | add_action( 'wp_enqueue_scripts', 'bareminimum_enqueue_scripts' );
87 | }
88 |
89 | /* =============================================================================
90 | #MENUS - Register menus
91 | */
92 |
93 | // Register main menu
94 | function bareminimum_register_menus() {
95 | register_nav_menu( 'main_menu', 'Main Menu' );
96 | }
97 | add_action( 'after_setup_theme', 'bareminimum_register_menus' );
98 |
99 | /* Print this menu in the theme template by copying this code:
100 |
101 | 'main_menu'));
103 | endif; ?>
104 |
105 | */
106 |
107 | /* =============================================================================
108 | #WIDGETS - Enqueue widget areas (sidebars and footers)
109 | */
110 |
111 | function bareminimum_register_widget_areas() {
112 |
113 | // Add whatever wrappers and classes you need for styling
114 | // The before/after keys have WordPress defaults and can be skipped
115 |
116 | $footer = array(
117 | 'name' => 'Footer widgets', // Displays in the WP dashboard
118 | 'id' => 'footer_widgets', // must be lowercase
119 | 'description' => '',
120 | 'before_widget' => '
',
121 | 'after_widget' => '
',
122 | 'before_title' => '
',
123 | 'after_title' => '
',
124 | );
125 | register_sidebar( $footer );
126 |
127 | /* Print this widget space in a theme template page by copying this code:
128 |
129 |
132 |
133 | */
134 |
135 | $sidebar = array(
136 | 'name' => 'Sidebar',
137 | 'id' => 'sidebar_widgets', // must be lowercase
138 | 'description' => '',
139 | 'before_widget' => '
',
140 | 'after_widget' => '
',
141 | 'before_title' => '
',
142 | 'after_title' => '
',
143 | );
144 | register_sidebar( $sidebar );
145 |
146 | }
147 | add_action( 'widgets_init', 'bareminimum_register_widget_areas' );
148 |
--------------------------------------------------------------------------------
/index.php:
--------------------------------------------------------------------------------
1 |
7 |
8 | // This section would usually go in a header.php file
9 | // And you would call it here with get_header();
10 | ?>
11 |
12 | >
13 |
14 | Reading
17 | // Defaults to UTF-8
18 | ?>
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | scripts and headers. Must include
30 | * for proper WP functionality. Same deal with wp_footer() below.
31 | */
32 | ?>
33 |
34 |
35 |
36 |
37 | >
38 |
39 |
40 |
41 | General
45 | * https://developer.wordpress.org/reference/functions/bloginfo/
46 | */
47 | ?>
48 |
52 |
53 |
54 |
55 | General in the WP dashboard
58 | * https://developer.wordpress.org/reference/functions/bloginfo/
59 | */
60 | ?>
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
76 |
77 |
78 |
83 |
84 |
88 | >
89 |
90 |
91 |
92 |
93 |
94 |
95 |
134 |
135 |
136 |
137 |
142 |
143 |
147 |
148 |
149 |
150 |
163 |
164 |
168 | * so we will follow their lead and put it here at the very bottom.
169 | */
170 | ?>
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------