Z. Steam Z. Steam - 4 months ago 16
PHP Question

Wordpress: How can I create an external page or file that contains posts with 1 specific category?

I'm developing a blog and custom theme with WordPress. My homepage has the 5 most recent posts with 4

div
s. Each
div
has a specific title like 'Personal Stories' or 'Tutorials'. I have created, within the WordPress manager, the 4 corresponding categories. I am quite new to PHP and WordPress in general, and I was wondering if it was possible to somehow add an anchor to each of those 4
div
s; that link to an external page with a list of posts with those specific categories?

I've tried creating new PHP files and linking the
index.php
file to them with an
<a>
tag, but I just simply get an 'ERROR 404'. I was hoping to implement 'The Loop' on these pages and filter the posts to just those with a specific category.

I've also tried using WordPress functions that create a URL with the category ID. As the
div
s do not have categories, I manually find them. In the end, I get something like this:

<a href="<?php get_category_link( 3 ); ?>">
<div id='story' class='circle'>
<p class='text'><br>People Stories</p>
</div>
</a>


And this is assuming that the number '3' is the ID I found when manually checking the categories.

Answer

Yes,
I added a

<a href="?cat=3">
<div id='#' class='#'>
    <p class='#'>...</p>
</div>
</a>


When I clicked on the <div>, it took me to the category.php page.



Thank you

Comments