Skip to content

Instantly share code, notes, and snippets.

@rhinkle
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save rhinkle/a136416891cb9125323c to your computer and use it in GitHub Desktop.

Select an option

Save rhinkle/a136416891cb9125323c to your computer and use it in GitHub Desktop.
One Page Template
function get_sub_page_type(){
//use editor ?
$editor_use = get_post_meta( get_the_ID(), 'editor_use', true);
$type = $editor_use;
if($type == 'featured_image'){
$featured_image_use = get_post_meta( get_the_ID(), 'featured_image_use', true);
$type = $featured_image_use;
}
return $type;
}
<?php /* Template Name: One Pager */
get_header();
global $post;
$count=1;
$args = array(
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
'post_type' => 'page',
'post_parent' => get_the_ID(),
'post_status' => 'publish',
'suppress_filters' => true
);
$posts_array = get_posts( $args );
foreach( $posts_array as $post ){
setup_postdata($post);
if( have_posts() ){
// $editor_use = get_post_meta( get_the_ID(), 'editor_use', true);
// $type = ($editor_use == 'none' || $editor_use == '') ? 'full' : $editor_use;
$type = get_sub_page_type();
do_action('page_before_content',get_the_ID());
?><article class="content-wrap section-<?php echo $count; ?> section-<?php echo $type; ?>" <?php echo apply_filters( 'section-background',$type); ?>>
<div class="has_background">
<div class="inside-wrap">
<div class="row"><?php
do_action('page_before_side_options');
get_template_part( 'partials/loop-section',$type);
do_action('page_after_side_options'); ?>
</div>
</div>
</div>
</article><!-- .content-wrap#front-page-wrap --><?php
do_action('page_after_content',get_the_ID());
}
$count++;
}
wp_reset_postdata();
get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment