WordPress.org

Forums

Category Code (9 posts)

  1. AbhishekPandit
    Member
    Posted 2 years ago #

    I Have Inserted My 3 categories and when i am clicking on the name of category it will jump to category.php but it should be show all the post of perticular category with category title

    please help me regarding this problem

  2. it should be show all the post of perticular category with category title

    what is it showing now?

    what theme are you using?

    does the theme have a category.php template?

    can you post a link to your site to illustrate the behaviour?

  3. AbhishekPandit
    Member
    Posted 2 years ago #

    Atchully Sir The I Am making My Own Customize Theme And I Am Having The category.php but I Just need The Code To Display The data I really Need It Urjently

    Please Help Me

  4. Andrew
    Forum moderator
    Posted 2 years ago #

    You can find urgent support here http://jobs.wordpress.net .

  5. AbhishekPandit
    Member
    Posted 2 years ago #

    Sir I Am Learning WordPress So Not Fully Aware With The WordPress System If you can provide me the code here so it will be very helpful for me

    please provide me the code

  6. apart from the html structure and the calls for header,footer, sidebar(?), the core function of a category.php could be:

    example with post titles in an unordered list:

    <?php single_cat_title();
    global $wp_query;
    $args = array_merge( $wp_query->query_vars, array( 'posts_per_page' => -1 ) );
    query_posts( $args );
    if( have_posts() ) : ?>
    <ul>
    <?php while( have_posts() ) : the_post(); ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    </li>
    <?php endwhile; ?>
    </ul>
    <?php else : echo 'no posts';
    endif; ?>

    see:
    http://codex.wordpress.org/Theme_Development
    http://codex.wordpress.org/The_Loop
    http://codex.wordpress.org/Function_Reference/single_cat_title
    http://codex.wordpress.org/Function_Reference/the_permalink
    http://codex.wordpress.org/Function_Reference/the_title
    http://codex.wordpress.org/Function_Reference/query_posts#Preserving_Existing_Query_Parameters

  7. AbhishekPandit
    Member
    Posted 2 years ago #

    thankyou very much for this code sir this code is working fine

    just tell me one more thing that "posts_per_page' => 30" i wrote this for the post and if i want all the post from category then what i will have to write

  8. see my example:

    'posts_per_page' => -1

    -1 calls all posts.

    alternatively change the one line in my suggested code to:

    $args = array_merge( $wp_query->query_vars, array( 'nopaging' => true ) );

    http://codex.wordpress.org/Class_Reference/WP_Query#Pagination_Parameters

  9. AbhishekPandit
    Member
    Posted 2 years ago #

    thankyou very much sir you such a helpful person

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags