<?php/** * @since Scratch JD 1.0.0 * * Proper way to enqueue scripts and styles */functionscratch_jd_scripts(){wp_enqueue_style('scratch-jd',get_stylesheet_uri());}add_action('wp_enqueue_scripts','scratch_jd_scripts');// Register Header and Footer Menusfunctionscratch_jd_theme_setup(){register_nav_menus(array('header-menu'=>__('Header','scratch-jd'),'footer-menu'=>__('Footer','scratch-jd'),));// Register a Sidebarregister_sidebar(array('id'=>'footer','name'=>__('Footer','textdomain'),'description'=>__('Displays in the footer on the left side','textdomain'),));}add_action('after_setup_theme','scratch_jd_theme_setup');/** * Add Theme Support * WordPress features that are not available by default * but desired for this theme * * Title Tag * https://codex.wordpress.org/Title_Tag * https://make.wordpress.org/core/2014/10/29/title-tags-in-4-1/ */functionscratch_jd_add_theme_support(){add_theme_support('title-tag');}add_action('after_setup_theme','scratch_jd_add_theme_support');
<?php/** * The template for displaying the header * * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * * @since Scratch JD 1.0.0 */?><!DOCTYPE html><html<?phplanguage_attributes();?>><head><?php// WordPress Header Scriptswp_head();// Check if function exists for 'title-tag' which is added in functions.phpif(!function_exists('_wp_render_title_tag')){functionscratch_jd_render_title(){?><title><?phpwp_title('-',true,'right');?></title><?php}add_action('wp_head','scratch_jd_render_title');}?><metacharset="<?phpbloginfo('charset');?>"><metaname="description"content="<?phpbloginfo('description');?>"><metaname="viewport"content="width=device-width, initial-scale=1.0"><aclass="skip-link screen-reader-text"href="#content"><?phpesc_html_e('Skip to content','scratch-jd');?></a><aclass="skip-link screen-reader-text"href="#footer"><?phpesc_html_e('Skip to footer','scratch-jd');?></a></head><body<?phpbody_class();?>><?php// Assign Header Menuwp_nav_menu(array('theme_location'=>'header-menu'));
<?php/** * The Index template: the catch-all template if a more specific template is not available * * @link https://developer.wordpress.org/themes/basics/template-files/#template-partials * * @since Scratch JD 1.0.0 */// Get the Headerget_header();?><divid="content"><?php// The Loopif(have_posts()){while(have_posts()){the_post();// Display the post title and HTML the_title();// Display post contentthe_content();}// end while}// end if?></div><!-- #content --><?php// Get the Footerget_footer();