Custom template in wordpress theme

One of the most important selling points of WordPress is the idea of themes. A single theme adds great value to the design and functionality of the website. However, there are websites that have different designs on different pages.

template.php ( you can give any name ):

<?php

   // Template Name: my custom template

?>

<header>

<?php
  get_header();
?>

</header>

<div class="card">

<?php
  if ( have_posts() ) : while( have_posts() ) : the_post(); ?>
<h1>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
</h1>

<a href="<?php the_permalink(); ?>">
<?php the_post_thumbnail( 'thumbnail' ); ?>
</a>

<p><?php the_excerpt(); ?></p>

<?php endwhile; endif;
?>

</div>

<footer>

<?php
  get_footer();
?>

</footer>

Leave a Reply