Skip to content

Instantly share code, notes, and snippets.

@dcooney
Last active October 23, 2021 01:29
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 dcooney/62ade53120ca155d19c5aa1a29bc1c8a to your computer and use it in GitHub Desktop.
Save dcooney/62ade53120ca155d19c5aa1a29bc1c8a to your computer and use it in GitHub Desktop.
Generate Single Template
<?php
/**
* The Template for displaying all single posts.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
get_header(); ?>
<div id="primary" <?php generate_do_element_classes( 'content' ); ?>>
<main id="main" <?php generate_do_element_classes( 'main' ); ?>>
<?php
/**
* generate_before_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_before_main_content' );
while ( have_posts() ) : the_post();
echo '<div id="alm-post-wrap">';
get_template_part( 'content', 'single' );
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || '0' != get_comments_number() ) :
/**
* generate_before_comments_container hook.
*
* @since 2.1
*/
do_action( 'generate_before_comments_container' );
?>
<div class="comments-area">
<?php comments_template(); ?>
</div>
<?php
endif;
echo '</div>';
endwhile;
/**
* generate_after_main_content hook.
*
* @since 0.1
*/
do_action( 'generate_after_main_content' );
?>
<?php
// Ajax Load More
$args = array(
'single_post' => 'true',
'single_post_id' => get_the_ID(),
'single_post_target' => '#alm-post-wrap',
'post_type' => 'post',
'pause_override' => 'true',
'scroll_distance' => '-500'
);
// $args['single_post_taxonomy'] = 'category';
if( function_exists( 'alm_render' ) ){
alm_render($args);
}
?>
<script>
window.almComplete = function(alm){
ezTOC.init();
};
</script>
<style>
.post-navigation{
display: none;
}
</style>
</main><!-- #main -->
</div><!-- #primary -->
<?php
/**
* generate_after_primary_content_area hook.
*
* @since 2.0
*/
do_action( 'generate_after_primary_content_area' );
generate_construct_sidebars();
?>
<?php get_footer(); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment