├── README.md ├── functions.php ├── index.php ├── screenshot.png ├── style.css ├── template-parts ├── content-none.php ├── content-page.php ├── content-search.php └── content.php └── theme-screenshot.png /README.md: -------------------------------------------------------------------------------- 1 | # blank-wordpress-theme-for-api 2 | A Blank WordPress theme for headless CMS projects 3 | 4 | ## Endpoints 5 | Provides links for different endpoints for the WordPress API 6 | 7 | ![screenshot](/theme-screenshot.png) 8 | -------------------------------------------------------------------------------- /functions.php: -------------------------------------------------------------------------------- 1 | tag in the document head, and expect WordPress to 27 | * provide it for us. 28 | */ 29 | add_theme_support( 'title-tag' ); 30 | 31 | /* 32 | * Enable support for Post Thumbnails on posts and pages. 33 | * 34 | * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ 35 | */ 36 | add_theme_support( 'post-thumbnails' ); 37 | 38 | // This theme uses wp_nav_menu() in one location. 39 | register_nav_menus( array( 40 | 'menu-1' => esc_html__( 'Primary', 'react' ), 41 | ) ); 42 | 43 | /* 44 | * Switch default core markup for search form, comment form, and comments 45 | * to output valid HTML5. 46 | */ 47 | add_theme_support( 'html5', array( 48 | 'gallery', 49 | 'caption', 50 | ) ); 51 | 52 | // Set up the WordPress core custom background feature. 53 | add_theme_support( 'custom-background', apply_filters( 'react_custom_background_args', array( 54 | 'default-color' => 'ffffff', 55 | 'default-image' => '', 56 | ) ) ); 57 | 58 | // Add theme support for selective refresh for widgets. 59 | add_theme_support( 'customize-selective-refresh-widgets' ); 60 | 61 | /** 62 | * Add support for core custom logo. 63 | * 64 | * @link https://codex.wordpress.org/Theme_Logo 65 | */ 66 | add_theme_support( 'custom-logo', array( 67 | 'height' => 250, 68 | 'width' => 250, 69 | 'flex-width' => true, 70 | 'flex-height' => true, 71 | ) ); 72 | } 73 | endif; 74 | add_action( 'after_setup_theme', 'react_setup' ); 75 | 76 | /** 77 | * Set the content width in pixels, based on the theme's design and stylesheet. 78 | * 79 | * Priority 0 to make it available to lower priority callbacks. 80 | * 81 | * @global int $content_width 82 | */ 83 | function react_content_width() { 84 | $GLOBALS['content_width'] = apply_filters( 'react_content_width', 640 ); 85 | } 86 | add_action( 'after_setup_theme', 'react_content_width', 0 ); 87 | 88 | /** 89 | * Register widget area. 90 | * 91 | * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar 92 | */ 93 | function react_widgets_init() { 94 | register_sidebar( array( 95 | 'name' => esc_html__( 'Sidebar', 'react' ), 96 | 'id' => 'sidebar-1', 97 | 'description' => esc_html__( 'Add widgets here.', 'react' ), 98 | 'before_widget' => '
', 99 | 'after_widget' => '
', 100 | 'before_title' => '

', 101 | 'after_title' => '

', 102 | ) ); 103 | } 104 | add_action( 'widgets_init', 'react_widgets_init' ); 105 | 106 | wp_enqueue_style( 'style', get_stylesheet_uri() ); 107 | 108 | /** 109 | * Load Jetpack compatibility file. 110 | */ 111 | if ( defined( 'JETPACK__VERSION' ) ) { 112 | require get_template_directory() . '/inc/jetpack.php'; 113 | } 114 | 115 | if( function_exists('acf_add_options_page') ) { 116 | 117 | acf_add_options_page(array( 118 | 'page_title' => 'Site Options', 119 | 'menu_title' => 'Site Options', 120 | 'menu_slug' => 'site-options', 121 | 'show_in_graphql' => true, 122 | )); 123 | 124 | } -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 |

This is a blank WordPress site that spits out JSON for Headless CMS goodness.

10 | 11 |

Here are some endPoints you might like:

12 | 13 | 17 | 37 |
38 | Theme by Adam Rasheed 39 |
40 |
41 | 42 | 43 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamrasheed/blank-wordpress-theme-for-api/6430cd22d818176fea3a3757fc0c3ee21b9eed39/screenshot.png -------------------------------------------------------------------------------- /style.css: -------------------------------------------------------------------------------- 1 | /* 2 | Theme Name: React 3 | Theme URI: https://github.com/adamrasheed/blank-wordpress-theme-for-api 4 | Author: Adam Rasheed 5 | Author URI: https://adamrasheed.com 6 | Description: A Blank WordPress theme made for Headless WordPress projects. This theme is a blank startkit that simply gives you endpoints links to access the REST API. Note, you will need the ACF to REST API plugin to access advanced custom fields in the API 7 | Version: 1.0 8 | License: GNU General Public License v2 or later 9 | License URI: http://www.gnu.org/licenses/gpl-2.0.html 10 | Tags: REST API, blank, startkit, react, api 11 | Text Domain: react 12 | 13 | This theme, like WordPress, is licensed under the GPL. 14 | Use it to make something cool, have fun, and share what you've learned with others. 15 | */ 16 | 17 | /* Reset */ 18 | html, body, div, span, applet, object, iframe, 19 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 20 | a, abbr, acronym, address, big, cite, code, 21 | del, dfn, em, img, ins, kbd, q, s, samp, 22 | small, strike, strong, sub, sup, tt, var, 23 | b, u, i, center, 24 | dl, dt, dd, ol, ul, li, 25 | fieldset, form, label, legend, 26 | table, caption, tbody, tfoot, thead, tr, th, td, 27 | article, aside, canvas, details, embed, 28 | figure, figcaption, footer, header, hgroup, 29 | menu, nav, output, ruby, section, summary, 30 | time, mark, audio, video { 31 | margin: 0; 32 | padding: 0; 33 | border: 0; 34 | font-size: 100%; 35 | font: inherit; 36 | vertical-align: baseline; 37 | } 38 | /* HTML5 display-role reset for older browsers */ 39 | article, aside, details, figcaption, figure, 40 | footer, header, hgroup, menu, nav, section { 41 | display: block; 42 | } 43 | body { 44 | line-height: 1; 45 | padding: 0 1rem; 46 | } 47 | ol, ul { 48 | list-style: none; 49 | } 50 | 51 | /* Custom Styles */ 52 | body{ 53 | font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica; 54 | font-size: 16px; 55 | line-height: 1.4; 56 | color: rgba(0,0,0,0.85); 57 | } 58 | 59 | .container{ 60 | max-width: 36rem; 61 | margin: 1rem auto; 62 | font-family: 'Fira Mono', Courier New, Courier, monospace; 63 | } 64 | 65 | h1, h2, h3, h4 { 66 | font-weight: bold; 67 | line-height: 1.25; 68 | } 69 | 70 | h1 {font-size: 2.25rem} 71 | h2 {font-size: 1.75rem} 72 | h3 {font-size: 1.25rem} 73 | 74 | a { color:#3c40c6} 75 | 76 | em { 77 | font-style: italic; 78 | opacity: 0.65; 79 | } 80 | .title{ 81 | margin-bottom: 1.5rem; 82 | } 83 | 84 | .subtitle{ 85 | margin-bottom: .75rem; 86 | } 87 | 88 | .list li{margin-bottom: 1rem} 89 | .link {font-weight: bold;} 90 | 91 | .credit{ 92 | font-size: .65rem; 93 | margin: 2rem 0; 94 | } 95 | 96 | .credit > a { 97 | display: inline-block; 98 | text-decoration: none; 99 | } 100 | 101 | .credit > a:hover { 102 | font-style: italic; 103 | text-decoration: underline; 104 | } -------------------------------------------------------------------------------- /template-parts/content-none.php: -------------------------------------------------------------------------------- 1 | 11 | 12 |
13 | 16 | 17 |
18 | 20 | 21 | 22 | 26 |
27 |
28 | -------------------------------------------------------------------------------- /template-parts/content-page.php: -------------------------------------------------------------------------------- 1 | 11 | 12 |
> 13 |
14 | ', '' ); ?> 15 |
16 | 17 | 18 | 19 |
20 | '', 26 | ) ); 27 | ?> 28 |
29 | 30 | 31 | 51 | 52 |
53 | -------------------------------------------------------------------------------- /template-parts/content-search.php: -------------------------------------------------------------------------------- 1 | 11 | 12 |
> 13 |
14 | ', esc_url( get_permalink() ) ), '' ); ?> 15 | 16 | 17 | 23 | 24 |
25 | 26 | 27 | 28 |
29 | 30 |
31 | 32 | 35 |
36 | -------------------------------------------------------------------------------- /template-parts/content.php: -------------------------------------------------------------------------------- 1 | 11 | 12 |
> 13 |
14 | ', '' ); 17 | else : 18 | the_title( '

', '

' ); 19 | endif; 20 | 21 | if ( 'post' === get_post_type() ) : ?> 22 | 28 | 30 |
31 | 32 | 33 |
34 | "%s"', 'react' ), 39 | array( 40 | 'span' => array( 41 | 'class' => array(), 42 | ), 43 | ) 44 | ), 45 | get_the_title() 46 | ) ); 47 | 48 | wp_link_pages( array( 49 | 'before' => '', 51 | ) ); 52 | ?> 53 |
54 | 55 |
56 | -------------------------------------------------------------------------------- /theme-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/adamrasheed/blank-wordpress-theme-for-api/6430cd22d818176fea3a3757fc0c3ee21b9eed39/theme-screenshot.png --------------------------------------------------------------------------------