Ограничение вывода записей на index.php

Как ограничить вывод новостей на главной index.php, чтоб выводилась одна новость
В настройках ставиш вывод одной новости, тогда и на всех будет выводится по одной, а надо чтоб только на главной, а на других выводилось столько, сколько укажеш в настройках

<? if ( is_home() ) query_posts(‘posts_per_page=1’) ?>
или плагин different-posts-per-page

<? if ( is_home() ) query_posts('posts_per_page=1') ?>

Где прописать его?

<? if ( is_home() ) query_posts('posts_per_page=1') ?>

Скажи пожалуйста куда его прописать- это index.php

    <div id="page">

        <?php
        if (isset($theme_options["show_featured"]) && isset($theme_options["featured_id"]) && $theme_options["featured_id"]!="") {
        }
        ?>

        <?php
        if (!isset($theme_options["layout_style"]) || $theme_options["layout_style"] == "scs") {
            include (TEMPLATEPATH . '/lsidebar.php');
        }
        ?>

        <div id="content">

            <?php include (TEMPLATEPATH . '/topads.php'); ?>
<? if ( is_home() ) query_posts('posts_per_page=1') ?>
            <?php if(is_home() && !is_paged() && isset($theme_options["show_featured"]) && isset($theme_options["featured_id"]) && $theme_options["featured_id"]!="") { include (TEMPLATEPATH . '/featuredpost.php'); } ?>
            
        <?php
        $temp = $wp_query;
        $wp_query= null;

        if(is_home() && !is_paged() && isset($theme_options["show_featured"]) && isset($theme_options["featured_id"]) && $theme_options["featured_id"]!="") {
            add_filter( 'posts_where', 'exclude_posts' );
            function exclude_posts( $where ) {
                global $wpdb;
                $theme_options = get_option('SimpleBalance');

                $whereExt =  " AND $wpdb->posts.ID != ".$theme_options["featured_id"];

                return $where . $whereExt;
            }
        }

        $wp_query = new WP_Query();
        $wp_query->query('&paged='.$paged);

        ?>

        <?php if (have_posts()) : ?>
            <?php
            $postCount = 0;
            if (isset($theme_options["home_fullposts"])) {
                $featLimit = $theme_options["home_fullposts"];
            }
            else {
                $featLimit = 1;
            }
            ?>
            <?php
            while (have_posts()) : the_post();
            if (isset($theme_options["show_featured"]) && isset($theme_options["featured_id"]) && $theme_options["featured_id"]!="" && $post->ID == $theme_options["featured_id"]) {                
                continue;
                update_post_caches($posts);
            }
            $postCount++;
            ?>
            <div class="post">
                <div class="postTitle"><h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2></div>
                <div class="postInfo">Опубликовано <?php the_time('d M Y'); ?> в рубрике «<?php the_category(', ') ?>» <?php edit_post_link('править', '(', ')'); ?></div>

                <div class="postContent">
                <?php
                if (isset($theme_options["home_excerpts"]) && $theme_options["home_excerpts"] == 0) {
                    the_content('<br />Читать полностью '.get_the_title('', '', false));
                }
                else {
                    if (is_home() && !is_paged() && $postCount <= $featLimit) {
                        the_content('<br />Читать полностью '.get_the_title('', '', false));
                    }
                    else {
                        the_excerpt();
                    }
                }
                ?>
                </div>

                <?php /*if(function_exists('the_tags')) { ?><div class="postExtras"><strong>Метки:</strong> <?php the_tags('', ', ', ''); ?></div><?php } */?>
                
                <div class="postMeta">
                    <span class="postLink"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>">Читать полностью</a></span>
                    <?php
                    $comNo = get_comment_type_count('comment'); // Checking if there are any actual comments (trackbacks and pingbacks excluded)

                    if ($comNo == 1 ) {
                    ?>
                    <span class="postComments"><?php comments_popup_link('Ваш отзыв', '1 отзыв', 'Отзывы: '.$comNo.' '); ?></span>
                    <?php }
                    elseif ($comNo > 1) {
                    ?>
                    <span class="postComments"><?php comments_popup_link('Ваш отзыв', '1 отзыв', 'Отзывы: '.$comNo.' '); ?></span>
                    <?php }
                    else {
                    ?>
                    <span class="postComments"><?php comments_popup_link('Ваш отзыв', 'Добавьте свой отзыв', 'Добавьте свой отзыв'); ?></span>
                    <?php } ?>
                </div>
            </div>
            <?php endwhile; ?>

            <div class="navigation">
                <div class="left"><?php previous_posts_link('&laquo; Раньше') ?></div>                
                <div class="right"><?php next_posts_link('Следующая &raquo;') ?></div>
                <?php if(function_exists('wp_cumulus_insert')) { wp_cumulus_insert(); } ?>
            </div>

            <?php $wp_query = null; $wp_query = $temp;?>


            <?php else: ?>
            Не найдено. 
            <?php endif; ?>
        </div>

        <?php
        if (isset($theme_options["layout_style"]) && $theme_options["layout_style"] == "css") {
            include (TEMPLATEPATH . '/lsidebar.php');
        }
        ?>

        <?php //include (TEMPLATEPATH . '/rsidebar.php'); ?>

    </div>
[quote=Ю.Б.]<? if ( is_home() ) query_posts('posts_per_page=1') ?>

Где прописать его?[/quote]
Перед Циклом (Loop). Вообще-то, на форуме есть поиск.

Anonymous
Отправить
Ответ на: