-1

How would I go about coding a generic tag.php page that displays all the posts with a specific tag?

For example, if I navigate to example.com/tag/your-tag, it should display all posts with the tag "your tag".

0

Create tag.php & save it in your theme directory. This is a default behavior of wordpress. So you don't have to struggle with it.

<?php 
    if ( have_posts() ) :

        // Start the Loop.
        while ( have_posts() ) : the_post();
            // Do your stuff here such as below
            the_title();
            the_content();

        endwhile;
    else:
        echo 'No Post Found';
    endif;
?>  

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.