Skip to content

Instantly share code, notes, and snippets.

@younes-dro
Created January 18, 2020 16:52
Show Gist options
  • Save younes-dro/5243eae124a35b7365c161965e8d7e87 to your computer and use it in GitHub Desktop.
Save younes-dro/5243eae124a35b7365c161965e8d7e87 to your computer and use it in GitHub Desktop.
Custom archive CPT
<?php
/**
* The template for displaying archive pages
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package WordPress
* @subpackage Twenty_Nineteen
* @since 1.0.0
*/
get_header();
?>
<section id="primary" class="content-area">
<main id="main" class="site-main">
<div class="dro-cpt">
<?php if ( have_posts() ) : ?>
<header class="page-header">
<?php
the_archive_title( '<h1 class="page-title">', '</h1>' );
?>
</header><!-- .page-header -->
<?php
// Start the Loop.
while ( have_posts() ) :
the_post();
the_title('<a class="dro-cpt-tab" href="#" data-id="'.get_the_ID().'">','</a>',TRUE);
echo '<div class="dro-cpt-description" id= "description-'.get_the_ID().'">';
the_post_thumbnail( 'thumbnail' );
echo '<div class=" single-description " >'.the_content().'</div>';
echo "</div>";
// End the loop.
endwhile;
// Previous/next page navigation.
twentynineteen_the_posts_navigation();
// If no content, include the "No posts found" template.
else :
get_template_part( 'template-parts/content/content', 'none' );
endif;
?>
<div class="dro-cpt-display"></div>
</div><!-- .dro-cpt -->
</main><!-- #main -->
</section><!-- #primary -->
<?php
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment