Answer the question
In order to leave comments, you need to log in
How to create a template for news in WP?
I can't understand, I'm trying like category-
{slug}.php - If the category's slug were news, WordPress would look for category-news.php
category-{id}.php - If the category's ID were 6, WordPress would look for category-6.php
category.php
archive.php
index.php
tried everything, only index.php works
, what could be the problem?
Answer the question
In order to leave comments, you need to log in
Hello!
The category, archive templates are designed to display a cycle of records. To display the post itself, you need the single.php template
A simple single.php template:
<?php get_header();?>
<div class="content">
<h1><?php the_title();?></h1>
<?php the_content();?>
</div>
<?php get_footer();?>
<?php get_header();?>
<div class="content">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h3>
<?php the_excerpt();?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_footer();?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question