Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
required+ Foundation WordPress template structure
<?php
/**
* The template used for displaying page content in page.php
*
* Example version to show how we overwrite the content output
* on a page in your child theme
*
* @link http://themes.required.ch/?p=755
*/
?>
<!-- START: content-page.php -->
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<h2 class="entry-title"><?php the_title(); ?></h2>
<h3 class="subheader">This is a page</h3>
</header><!-- .entry-header -->
<div class="entry-content">
<?php the_content(); ?>
<?php wp_link_pages( array(
'before' => '<div class="page-link"><span>' . __( 'Pages:', 'yourtextdomain' ) . '</span>',
'after' => '</div>'
) ); ?>
</div><!-- .entry-content -->
</article><!-- #post-<?php the_ID(); ?> -->
<!-- END: content-page.php -->
<?php if ( is_singular() ) : ?>
<div id="author-info">
<div id="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'required_author_bio_avatar_size', 68 ) ); ?>
</div><!-- #author-avatar -->
<div id="author-description">
<h2><?php printf( esc_attr__( 'About %s', 'yourtextdomain' ), get_the_author() ); ?></h2>
<?php if ( get_the_author_meta( 'description' ) ) : ?>
<?php the_author_meta( 'description' ); ?>
<?php else : ?>
<p><?php _e( 'Oops, this author forgot to fill out his description, but we are sure he or she is a cool fella!', 'yourtextdomain' ); ?></p>
<?php endif; ?>
<div id="author-link">
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'yourtextdomain' ), get_the_author() ); ?>
</a>
</div><!-- #author-link -->
</div><!-- #author-description -->
</div><!-- #entry-author-info -->
<?php endif; ?>
<?php
/**
* Entry meta in the footer of posts of all post formats
*
* We will use this as an example entry-meta.php in one of our
* tutorials for required+ Foundation.
*
* @link http://themes.required.ch/?p=755
*/
?>
<!-- START: entry-meta.php -->
<?php $show_sep = false; ?>
<?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
<?php
/* translators: used between list items, there is a space after the comma */
$categories_list = get_the_category_list( __( ', ', 'yourtextdomain' ) );
if ( $categories_list ):
?>
<span class="cat-links">
<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'yourtextdomain' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
$show_sep = true; ?>
</span>
<?php endif; // End if categories ?>
<?php
/* translators: used between list items, there is a space after the comma */
$tags_list = get_the_tag_list( '', __( ', ', 'yourtextdomain' ) );
if ( $tags_list ):
if ( $show_sep ) : ?>
<span class="sep"> | </span>
<?php endif; // End if $show_sep ?>
<span class="tag-links">
<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'yourtextdomain' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
$show_sep = true; ?>
</span>
<?php endif; // End if $tags_list ?>
<?php endif; // End if 'post' == get_post_type() ?>
<?php if ( comments_open() ) : ?>
<?php if ( $show_sep ) : ?>
<span class="sep"> | </span>
<?php endif; // End if $show_sep ?>
<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'yourtextdomain' ) . '</span>', __( '<b>1</b> Reply', 'yourtextdomain' ), __( '<b>%</b> Replies', 'yourtextdomain' ) ); ?></span>
<?php endif; // End if comments_open() ?>
<?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries ?>
<div id="author-info">
<div id="author-avatar">
<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'required_author_bio_avatar_size', 68 ) ); ?>
</div><!-- #author-avatar -->
<div id="author-description">
<h2><?php printf( esc_attr__( 'About %s', 'yourtextdomain' ), get_the_author() ); ?></h2>
<?php the_author_meta( 'description' ); ?>
<div id="author-link">
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
<?php printf( __( 'View all posts by %s <span class="meta-nav">&rarr;</span>', 'yourtextdomain' ), get_the_author() ); ?>
</a>
</div><!-- #author-link -->
</div><!-- #author-description -->
</div><!-- #entry-author-info -->
<?php endif; ?>
<!-- END: entry-meta.php -->
/**
* Prints HTML with meta information for the current post-date/time and author.
*
* @link http://themes.required.ch/?p=755
*/
function required_posted_on() {
printf( __( '<h6>On <a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a> <span class="author vcard"><a class="url fn n" href="%5$s" title="%6$s" rel="author">%7$s</a></span> published:</h6>', 'yourtextdomain' ),
esc_url( get_permalink() ),
esc_attr( get_the_time() ),
esc_attr( get_the_date( 'c' ) ),
esc_html( get_the_date() ),
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
sprintf( esc_attr__( 'View all posts by %s', 'yourtextdomain' ), get_the_author() ),
esc_html( get_the_author() )
);
}
<?php
/**
* The template for displaying all pages.
*
* Demo page template to show how easy it is to
* overwrite a template in your child theme.
*
* @link http://themes.required.ch/?p=755
*/
get_header(); ?>
<!-- Row for main content area -->
<div id="content" class="row">
<!-- Wow we changed the column span -->
<div id="main" class="six columns" role="main">
<div class="post-box">
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'page' ); ?>
<?php endwhile; // end of the loop. ?>
</div>
</div><!-- /#main -->
<!-- Wow we changed the column span -->
<aside id="sidebar" class="six columns" role="complementary">
<div class="sidebar-box">
<?php get_sidebar(); ?>
</div>
</aside><!-- /#sidebar -->
</div><!-- End Content row -->
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment