Richard Cook
Mar 4
Responsive Web Design Tester
Test all your responsive design here. It works and you can scroll through each size and device.
Test all your responsive design here. It works and you can scroll through each size and device.
Take a listen to this episode of the Web Ahead podcast, where Jen Simmons interviews Eric Meyer. The podcast takes a little while to get going, but once it does you’ll hear some great stories and perspective on the history of the web and his ideas of its long-term future a medium. Eric Meyer was influential in the promotion of CSS as a legitimate web design tool in the early 2000s, and he’s continued to develop some very smart coding techniques since then while working on large projects.
Here’s a demo of a relatively simple archive page. (You might want to delete the page-archive.php
file that came with your theme, since it uses a different function than the one we’ve discussed.
This method uses the function called get_posts()
, described in the post about Wordpress Loops to work, you would do the following:
page.php
, duplicate it, and rename the copy to page-archive.php
.page.archive.php
file in Textwrangler and change the comment at the top to read exactly as it does in the example below. The crucial part is “Template Name: Archive page”, which Wordpress will use to recognize this file as a new page template.page-archge.php
, save it, and upload it to your theme directory.Here’s an example of a straightforward archive template that lists all your posts in reverse chronological order. You can of course use different arguments for get_posts(). Refer to the Wordpress Codex to see how.
<?php
/**
* Template Name: Archive Page
*
* @package WordPress
* @subpackage My Theme
*/
include('header.php'); ?>
<body id="page">
<?php include('nav.php'); ?>
<section id="main" role="main" class="cf">
<h1>Awesome Archive Page</h1>
<ul class="post-list">
<?php
// 1. store our loop preferences in an array
$args = array('numberposts' => 999, // notice this has to be "numberposts", not "posts_per_page"
'order' => 'DESC', // the other option is ASC
'orderby' => 'post_date',
'post_type' => 'post',
'post_status' => 'publish'
);
// 2. Run get_posts() on the $args array and store the result in $myposts
$myposts = get_posts( $args );
// 3. Run a foreach loop on $myposts to access our content, combined with the annoying-but-necessary setup_postdata function.
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php include('snippet-post-link.php'); ?>
<?php endforeach; ?>
</ul>
<?php include('footer.php'); ?>
It looks like category.php
has a mistake in it. There’s an extra wrapping div
around the nav
include that shouldn’t be there.
So change these lines….
<div id="nav">
<?php include('nav.php'); ?>
</div><!-- #nav -->
to just this:
<?php include('nav.php'); ?>