Last active
March 7, 2016 07:32
-
-
Save richjava/b8d7ba8209f7afc600aa to your computer and use it in GitHub Desktop.
Wordpress Theme Development task 1 - Basic custom theme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The front page template file. | |
*/ | |
get_header(); | |
if (have_posts()) : | |
while (have_posts()) : the_post(); | |
the_content(); | |
endwhile; | |
else : | |
echo '<p>No content found</p>'; | |
endif; | |
get_footer(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Adds functionality to the theme of the site. | |
* @see https://codex.wordpress.org/Functions_File_Explained | |
*/ | |
/** | |
* Enqueue scripts and styles. | |
*/ | |
function enqueue_scripts() { | |
wp_enqueue_style('style', get_stylesheet_uri()); | |
} | |
add_action( 'wp_enqueue_scripts', 'enqueue_scripts' ); | |
/** | |
* Register navigation menus so they can be configured in the Admin Dashboard. | |
*/ | |
register_nav_menus(array( | |
'primary' => __( 'Primary Menu'), | |
'footer' => __( 'Footer Menu'), | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The header template file. | |
* Displays all of the head element and everything up until the "site-content" div. | |
*/ | |
?><!DOCTYPE html> | |
<html <?php language_attributes(); ?> class="no-js"> | |
<head> | |
<meta charset="<?php bloginfo('charset'); ?>"> | |
<meta name="viewport" content="width=device-width"> | |
<link rel="profile" href="http://gmpg.org/xfn/11"> | |
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>"> | |
<!--[if lt IE 9]> | |
<script src="<?php echo esc_url(get_template_directory_uri()); ?>/js/html5.js"></script> | |
<![endif]--> | |
<?php wp_head(); ?> | |
</head> | |
<body <?php body_class(); ?>> | |
<div id="content" class="site-content"> | |
<header> | |
Header content goes here | |
<nav class="site-nav"> | |
<?php | |
// for more on menus and navigation, see the video at | |
// https://www.youtube.com/watch?v=AShql_Ap1Yo&list=PLpcSpRrAaOaqMA4RdhSnnNcaqOVpX7qi5&index=4 | |
wp_nav_menu(); ?> | |
</nav> | |
</header> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Template Name: Blog | |
* NOTE: Because of a Wordpress anti-pattern, index.php is used for the the Blog page | |
* rather than using slugs or id(i.e. "page-blog", "page-{id}"). | |
* @see https://make.wordpress.org/themes/2014/06/28/correct-handling-of-static-front-page-and-custom-blog-posts-index-template/ | |
*/ | |
get_header(); | |
if (have_posts()) : | |
while (have_posts()) : the_post(); | |
?> | |
<h2><?php the_title(); ?></h2> | |
<p><?php the_content(); ?></p> | |
<?php endwhile; ?> | |
<?php | |
else : | |
echo '<p>No content found</p>'; | |
endif; | |
get_footer(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* The page template file. | |
*/ | |
get_header(); | |
if (have_posts()) : | |
while (have_posts()) : the_post(); | |
the_content(); | |
endwhile; | |
else : | |
echo '<p>No content found</p>'; | |
endif; | |
get_footer(); | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Created on : Mar 2, 2016, 10:41:30 AM | |
Author : richard_lovell | |
*/ | |
header, footer{ | |
background:#e9e9e9; | |
} | |
ul li.current_page_item a{ | |
background-color:#006; | |
color:#fff; | |
text-decoration: none; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment