WordPress.org

Forums

Create page which includes one category (6 posts)

  1. mrbrut
    Member
    Posted 8 years ago #

    Hello,
    I've done a fair bit of searching and playing around trying this and that but am having no luck.
    What I want to do is create a page called 'Podcasts' and when clicked on it takes you to the page which shows all of the posts that are in the 'podcast' category.
    Can someone please help me out on this one as I know it is a simple task but I am having no luck.
    If you need to my wordpress install is located at hundredpennies.com
    Regards

  2. Joe Hall
    Member
    Posted 8 years ago #

    Find out the category ID of "Podcast". It should be a number. For this example lets assume that the number is 15. Now, copy the index.php page out of your theme folder. Rename the file category-15.php Where 15 is the category ID for "Podcast". Now, put your new file back in your theme folder. To point to that page have any links that you want to point to that page carry this URL: http://www.hundredpennies.com/category/podcast/

    That should produce a separate page that only displays post in the podcast category.

  3. mrbrut
    Member
    Posted 8 years ago #

    awesome thank you for your help. another question, how do i now create a page that will now display the contents of category-15.php?

  4. Storyman
    Member
    Posted 7 years ago #

    mrbrut,

    Visited your site and apparently you found a solution to your question--there is a Podcast link on the menu bar.

    Would you mind sharing how you did it?

  5. mrbrut
    Member
    Posted 7 years ago #

    i created a file called 'podcast.php' and made sure that it had the template name at the top. my podcast category is 21 so i put in a query so that it displays that category.

    hopfully to make sense i'll include the page below and if you have any questions please let me know. it was actually quite easy once i understood how a page is made up and queries etc... i guess it's all part of the learning experience!

    <?php /*
        Template Name: Podcast
    */ ?>
    <?php get_header(); ?>
    <?php
        if (is_home()) {
        query_posts("cat=-21");
        }
    ?>
    
    <?php
        $events_cat = '21'; 
    
        if (!is_paged()) {
            query_posts('cat=' . $events_cat);
        } else {
            query_posts('cat=' . $events_cat . '&paged=' . $paged);
        }
    ?>
            <?php include (TEMPLATEPATH . '/theloop.php'); ?> 
    
        </div> 
    
        <?php get_sidebar(); ?> 
    
    </div> 
    
    <?php get_footer(); ?>
  6. jonasbk
    Member
    Posted 7 years ago #

    Sweet the coding part works for me sofar...

    I was just wondering - how can I get a header for the "new" Page? It "only" shows the posts in the specific category!

    Thanks

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags