WordPress.org

Forums

Get the current pages Category id (2 posts)

  1. varunkrish
    Member
    Posted 9 years ago #

    how do i get the current pages category_id ?

    i want to get the category_id of current category page.

    i am using seperate template for category archives called category.php

    How do i get it working?

  2. syncbox
    Member
    Posted 9 years ago #

    If you want to have different layouts per category, create a file named category-1.php (where the category id=1, etc), then, query for that category just before the loop:


    <?php
    query_posts("cat=13&order=ASC");
    ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    does that help?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.