Skip to content

Instantly share code, notes, and snippets.

@petersplugins
Last active July 11, 2019 11:38
Show Gist options
  • Save petersplugins/fd6886660f7b2390a0529a96fdc9b88a to your computer and use it in GitHub Desktop.
Save petersplugins/fd6886660f7b2390a0529a96fdc9b88a to your computer and use it in GitHub Desktop.
<div class="container">
<div id="primary">
<div id="content">
<?php
$pp404 = false;
// instead of is_404() you'll probably use another code to identify a 404 error
// if PP_404 is defined the 404page plugin is active
// if pp_404_is_active() returns true a custom 404 page is selected and exists ?>
if ( is_404() && defined( 'PP_404' ) && pp_404_is_active() ) {
pp_404_set_native_support();
$pp404 = true;
}
?>
<?php // using a do while loop ensures that the loop is exuted at least once even if there are no posts ?>
<?php do { ?>
<?php if ( !$pp404 ) { the_post(); } ?>
<article class="post">
<h1 class="title"><?php if ( $pp404 ) { pp_404_the_title(); } else { the_title(); } ?></h1>
<div class="the-content">
<?php if ( $pp404 ) { pp_404_the_content(); } else { the_content(); } ?>
<?php if ( ! $pp404 ) { wp_link_pages(); } ?>
</div>
<article>
<?php } while ( have_posts() ); ?>
</div>
</div>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment