Skip to content

Instantly share code, notes, and snippets.

@rachelmccollin
Forked from anonymous/style_comments.css
Last active April 29, 2018 00:17
Show Gist options
  • Save rachelmccollin/2b693721668dba8bcc578b8de9824642 to your computer and use it in GitHub Desktop.
Save rachelmccollin/2b693721668dba8bcc578b8de9824642 to your computer and use it in GitHub Desktop.
WPMU Create a WordPress theme from static HTML
<h2><?php the_archive_title(); ?></h2>
<?php get_template_part( 'includes/loop', 'archive' ); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<article class="post">
<body <?php body_class(); ?>>
<body class="home blog logged-in admin-bar no-customize-support" data-gr-c-s-loaded="true" style="">
<section class="entry-meta">
<?php echo get_the_date(); ?>
</section><!-- .entry-meta -->
<?php get_header(); ?>
<?php get_template_part( 'includes/loop' ); ?>
<?php get_template_part( 'includes/loop', 'page' ); ?>
<?php get_sidebar(); ?>
<!DOCTYPE html>
<!--[if lt IE 7]><html lang="en-US" class="ie6"><![endif]-->
<!--[if IE 7]><html lang="en-US" class="ie7"><![endif]-->
<!--[if IE 8]><html lang="en-US" class="ie8"><![endif]-->
<!--[if IE 9]><html lang="en-US" class="ie9"><![endif]-->
<!--[if gt IE 9]><html lang="en-US"><![endif]-->
<!--[if !IE]><html lang="en-US"><![endif]-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title>WordPress Writer and Instructor | RACHEL McCOLLIN</title>
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
<link href="https://fonts.googleapis.com/css?family=Assistant|Oswald" rel="stylesheet">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<div class="header-bg">
<header role="banner">
<hgroup class="site-name three-quarters left">
<!-- site name and description - site name is inside a div element on all pages execpt the front page and/or main blog page, where it is in a h1 element -->
<h1 id="site-title" class="one-half-left">
<a href="https://rachelmccollin.com/" title="RACHEL McCOLLIN" rel="home">RACHEL McCOLLIN</a>
</h1>
<h2 id="site-description">Fiction and Technical Writer</h2>
</hgroup>
<div class="right quarter">
<a class="toggle-nav" href="#">&#9776;</a>
</div> <!-- .right quarter -->
</header><!-- header -->
</div><!-- header-bg-->
<!-- full width navigation menu -->
<nav class="menu main">
<div class="skip-link screen-reader-text"><a href="#content" title="Skip to content">Skip to content</a></div>
<div class="main-nav">
<ul class="menu">
<li class="menu-item"><a href="https://rachelmccollin.com/">Home</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/about-me/">About Me</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/books/">Books</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/bookclub/">Book Club</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/blog/">Blog</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/contact/">Contact</a></li>
</ul>
</div>
</nav><!-- .main -->
<title>WordPress Writer and Instructor | RACHEL McCOLLIN</title>
<?php
/* The main index file */
?>
<?php get_header(); ?>
<div class="main">
<div id="content" class="two-thirds left">
<?php get_template_part( 'includes/loop' ); ?>
</div><!-- #content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
<?php
/* The main index file */
?>
<?php while ( have_posts() ) : the_post(); //Open the loop ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h3 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<section class="entry-meta">
<?php echo get_the_date(); ?>
</section><!-- .entry-meta -->
<section class="entry-content">
<?php the_content(); ?>
</section><!-- .entry-content -->
</article>
<?php endwhile; // End the loop. ?>
<?php while ( have_posts() ) : the_post(); //Open the loop ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<section class="entry-meta">
<?php echo get_the_date(); ?>
</section><!-- .entry-meta -->
<section class="entry-content">
<?php the_content(); ?>
</section><!-- .entry-content -->
<section class="entry-utility">
<?php comments_template(); ?>
</section><!-- .entry-utility -->
</article>
<?php endwhile; // End the loop. ?>
<?php while ( have_posts() ) : the_post(); //Open the loop ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<section class="entry-meta">
<?php echo get_the_date(); ?>
</section><!-- .entry-meta -->
<section class="entry-content">
<?php the_content(); ?>
</section><!-- .entry-content -->
<section class="entry-utility">
<?php comments_template(); ?>
</section><!-- .entry-utility -->
</article>
<?php endwhile; // End the loop. ?>
<title>WordPress Writer and Instructor | RACHEL McCOLLIN</title>
<nav class="menu main">
<div class="skip-link screen-reader-text">
<a href="#content" title="<?php esc_attr_e( 'Skip to content', 'wpmu' ); ?>"><?php _e( 'Skip to content', 'wpmu' ); ?></a>
</div>
<?php wp_nav_menu( array( 'container_class' => 'main-nav', 'theme_location' => 'primary' ) ); ?>
</nav><!-- .main -->
<nav class="menu main">
<div class="skip-link screen-reader-text"><a href="#content" title="Skip to content">Skip to content</a></div>
<div class="main-nav">
<ul class="menu">
<li class="menu-item"><a href="https://rachelmccollin.com/">Home</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/about-me/">About Me</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/books/">Books</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/bookclub/">Book Club</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/blog/">Blog</a></li>
<li class="menu-item"><a href="https://rachelmccollin.com/contact/">Contact</a></li>
</ul>
</div>
</nav><!-- .main -->
<?php
/* The template file for dispalying static pages */
?>
<h2 class="entry-title"><?php the_title(); ?></h2>
/****************************************************************************
Register widgets
****************************************************************************/
function wpmu_register_widgets() {
// Sidebar widget area, located in the sidebar. Empty by default.
register_sidebar( array(
'name' => __( 'Sidebar Widget Area', 'wpmu' ),
'id' => 'sidebar-widget-area',
'description' => __( 'The sidebar widget area', 'wpmu' ),
'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
// First footer widget area, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'First Footer Widget Area', 'wpmu' ),
'id' => 'first-footer-widget-area',
'description' => __( 'The first footer widget area', 'wpmu' ),
'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
// Second Footer Widget Area, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Second Footer Widget Area', 'wpmu' ),
'id' => 'second-footer-widget-area',
'description' => __( 'The second footer widget area', 'wpmu' ),
'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
// Third Footer Widget Area, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'Third Footer Widget Area', 'wpmu' ),
'id' => 'third-footer-widget-area',
'description' => __( 'The third footer widget area', 'wpmu' ),
'before_widget' => '<div id="%1$s" class="widget-container %2$s">',
'after_widget' => '</div>',
'before_title' => '<h3 class="widget-title">',
'after_title' => '</h3>',
) );
}
add_action( 'widgets_init', 'wpmu_register_widgets' );
<aside class="sidebar one-third right">
<aside class="widget-area">
<div class="widget-container">
<h3 class="widget-title">Buy My Book</h3>
<img width="242" height="300" src="https://rachelmccollin.com/wp-content/uploads/2017/09/front-cover-e1506593809874-242x300.jpg" alt="WordPress: Pushing the Limits by Rachel McCollin" style="max-width: 100%; height: auto;" />
<p><em>WordPress: Pushing the Limits</em> will help you become a professional WordPress developer.</p>
</div>
</aside>
</aside>
<aside class="widget-area">
<div class="widget-container">
<h3 class="widget-title">Buy My Book</h3>
<img width="242" height="300" src="https://rachelmccollin.com/wp-content/uploads/2017/09/front-cover-e1506593809874-242x300.jpg" alt="WordPress: Pushing the Limits by Rachel McCollin" style="max-width: 100%; height: auto;" />
<p><em>WordPress: Pushing the Limits</em> will help you become a professional WordPress developer.</p>
</div>
</aside>
<?php if ( is_active_sidebar( 'sidebar-widget-area' ) ) { ?>
<aside class="widget-area">
<?php dynamic_sidebar( 'sidebar-widget-area' ); ?>
</aside>
<?php } ?>
<?php
/* The file for displaying single posts */
?>
<?php get_header(); ?>
<div class="main">
<div id="content" class="two-thirds left">
<?php get_template_part( 'includes/loop', 'single' ); ?>
</div><!-- #content -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
<h2 class="entry-title"><?php the_title(); ?></h2>
<h1 id="site-title">
<a href="<?php echo site_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home">
<?php bloginfo( 'name' ); ?>
</a>
</h1>
<h2 id="site-description"><?php bloginfo( 'description' ); ?></h2>
<h1 id="site-title" class="one-half-left">
<a href="https://rachelmccollin.com/" title="RACHEL McCOLLIN" rel="home">RACHEL McCOLLIN</a>
</h1>
<h2 id="site-description">Fiction and Technical Writer</h2>
/*
Theme Name: WPMU DEV Basic Theme
Theme URI: https://github.com/rachelmccollin/WPMU-DEV-Theme-Development-Series-Files/
Description: Theme to accompany a series of posts on creating a WordPress theme from static HTML.
Author: Rachel McCollin
Author URI: https://rachelmccollin.com/
Version: 1.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
<?php
/****************************************************************************
Theme setup
****************************************************************************/
function wpmu_theme_setup() {
// translation
load_theme_textdomain( 'wpmu', get_stylesheet_directory() . '/languages' );
// post formats
add_theme_support( 'post_formats' );
// Post thumbnails or featured images
add_theme_support( 'post-thumbnails', array( 'post', 'page' ) );
// RSS feed links to head
add_theme_support( 'automatic-feed-links' );
// navigation menu
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'wpmu' )
) );
}
add_action( 'after_setup_theme', 'wpmu_theme_setup' );
// title tags
add_theme_support( 'title-tag' );
<?php wp_head(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment