Reputation: 151
I am completely new in Wordpress, please forgive me for my stupid question. I want to create menu with all categories. I created such menu but after clicking on specific menu item with category name it links me to my home page. What code should i add to my page to display all posts with specific category?
Upvotes: 0
Views: 260
Reputation: 793
Inside your wordpress theme you must have a page called "content.php" Which will get included through the code below. In that template you can huse the wordpress functions like so... the_title(); And so on.. You will just have to check the Wordpress Codex
$args['tax_query'][] =
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => 'category slug must go here'
);
<?php $query = new WP_Query($args); ?>
<?php while ( $query->have_posts() ) : the_post(); ?>
<div>
<?php
$query->the_post();
get_template_part( 'content', get_post_format() );
?>
</div>
<?php endwhile; ?>
Upvotes: 1