Skip to content

Instantly share code, notes, and snippets.

@IkeTen
Last active January 6, 2017 18:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IkeTen/3a1b438908fae310e74c94b74cd0f784 to your computer and use it in GitHub Desktop.
Save IkeTen/3a1b438908fae310e74c94b74cd0f784 to your computer and use it in GitHub Desktop.
Template for Page Sections with Cornerstone
<?php
/**
* @package GeneratePress
*/
// No direct access, please
if ( ! defined( 'ABSPATH' ) ) exit;
?>
<?php
$articlesclasses = array(
'generate-columns',
'grid-33',
'tablet-grid-50',
'mobile-grid-100',
);
?>
<article id="post-<?php the_ID(); ?>" <?php post_class($articlesclasses); ?> <?php generate_article_schema( 'CreativeWork' ); ?> >
<div class="inside-article">
<?php do_action( 'generate_before_content' ); ?>
<div class="post-image">
<a href="<?php the_permalink();?>" title="<?php esc_attr( the_title() ); ?>"><?php the_post_thumbnail( apply_filters( 'generate_page_header_default_size', 'full' ), array('itemprop' => 'image') ); ?></a>
</div>
<header class="entry-header">
<?php do_action( 'generate_before_entry_title' ); ?>
<?php the_title( sprintf( '<h2 class="entry-title" itemprop="headline"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>
<?php do_action( 'generate_after_entry_title' ); ?>
</header><!-- .entry-header -->
<?php do_action( 'generate_after_entry_header' ); ?>
<?php if ( true == generate_show_excerpt() ) : ?>
<div class="entry-summary" itemprop="text">
<?php the_excerpt(); ?>
</div><!-- .entry-summary -->
<?php else : ?>
<div class="entry-content" itemprop="text">
<?php the_content(); ?>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . __( 'Pages:', 'generatepress' ),
'after' => '</div>',
) );
?>
</div><!-- .entry-content -->
<?php endif; ?>
<?php do_action( 'generate_after_entry_content' ); ?>
<?php do_action( 'generate_after_content' ); ?>
</div><!-- .inside-article -->
</article><!-- #post-## -->
<?php
/**
* Template Name: Sections
* The template for displaying Cornerstone Section pages.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package GeneratePress
*/
// No direct access, please
if ( ! defined( 'ABSPATH' ) ) exit;
get_header(); ?>
<div id="primary" class="content-area grid-parent mobile-grid-100 grid-100 tablet-grid-100">
<main id="main" <?php generate_main_class(); ?> itemtype="http://schema.org/Blog" itemscope="itemscope" itemprop="mainContentOfPage" role="main">
<div class="generate-columns-container">
<?php do_action( 'generate_before_main_content' ); ?>
<?php if ( cnr_have_children() ) : ?>
<?php if ( generate_show_title() ) : ?>
<header class="page-header">
<?php single_post_title( '<h1 class="page-title" itemprop="headline">All Stories in ', '</h1>' ); ?>
</header><!-- .entry-header -->
<?php endif; ?>
<?php /* Start the Loop */ ?>
<?php while ( cnr_have_children() ) : cnr_next_child(); ?>
<?php
/* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part( 'content', 'section' );
?>
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
<?php generate_content_nav( 'nav-below' ); ?>
<?php else : ?>
<?php get_template_part( 'no-results', 'index' ); ?>
<?php endif; ?>
<?php do_action( 'generate_after_main_content' ); ?>
</div><!-- .generate-columns-container -->
</main><!-- #main -->
</div><!-- #primary -->
<?php
do_action( 'generate_sidebars' );
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment