WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Change the number of posts shown in diferent categories (3 posts)

  1. Madcore
    Member
    Posted 6 years ago #

    Hi folks.

    I want to show in some categories more than the ten posts per page i´ve defined in the options page. For example, 30 in category 4, only one in category 6, etc... I´ve searched in the codex one way to do this, but didn´t found anything. How can I do this, if there is a way to make that?

    Thanks to all.

  2. MichaelH
    Member
    Posted 6 years ago #

    I believe Custom Query String might help you:
    http://drunkenmonkey.org/user/archive/custom-query-string-2.6.zip

  3. Madcore
    Member
    Posted 6 years ago #

    Thanks MichaelH. I´m going to download and give it a try ^_^.

    Anyway, I´ve found a solution by myself using the customizable post listings plugin, making some changes on one of the docs I´ve found on the codex. This is my lines:


    <?php get_header(); ?>
    <?php if ( in_category(4) || in_category (8) || in_category (9) || in_category (10) || in_category (11) || in_category (12) || in_category (13) || in_category (14) || in_category (21) || in_category (24) || in_category (35) || in_category (36) ) {
    $wp_query->query_vars['cat'];
    echo '<div id="content"><div id="thumb-gallery">';
    c2c_get_recent_posts(1000, "%post_excerpt%", $cat);
    echo '</div></div><div id="sidebar">

      ';
      if ( function_exists('dynamic_sidebar') && dynamic_sidebar(2) ) :
      else :
      endif;
      echo '
    </div>';
    } else {
    echo '<div id="content">¿que?';
    echo '</div>';
    get_sidebar();
    }
    ?>
    <?php get_footer(); ?>

    In the codex example, the $wp_query->query_vars['cat'] goes inside the plugin function. That gives an sql error in my page. But putting that line outside and before the plugin makes it work perfect. I hope this can be helpfull in anyway to somebody.

    Again, thanks for your help, MichaelH.

Topic Closed

This topic has been closed to new replies.

About this Topic