Есть отдельный шаблон для вывода рубрик (category.php)?
да, тема стандартная twentyten
Только что проверила. Если добавить исключение только в index.php, то на остальных страницах записи остаются, как и должно быть.
index.php
<?php
/**
* The main template file.
*
* This is the most generic template file in a WordPress theme
* and one of the two required files for a theme (the other being style.css).
* It is used to display a page when nothing more specific matches a query.
* E.g., it puts together the home page when no home.php file exists.
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Ten
* @since Twenty Ten 1.0
*/
get_header(); ?>
<div id="container">
<div id="content" role="main">
<?php
/* Run the loop to output the posts.
* If you want to overload this in a child theme then include a file
* called loop-index.php and that will be used instead.
*/
get_template_part( 'loop', 'index' );
?>
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
куда вставлять?
Перепутала тему, разумеется. Можно скопировать loop.php, назвать его loop-index.php и внести изменения туда. Тогда главная будет подхватывать его, а страница рубрики — первоначальный loop.php.
но в loop.php нет строки
if (have_posts()) : while (have_posts()) : the_post();
я просто в index.php вроде заработало 🙂
есть
<?php if ( ! have_posts() ) : ?>
и
<?php while ( have_posts() ) : the_post(); ?>
А у меня есть.
/* Start the Loop.
*
* In Twenty Ten we use the same loop in multiple contexts.
* It is broken into three main parts: when we're displaying
* posts that are in the gallery category, when we're displaying
* posts in the asides category, and finally all other posts.
*
* Additionally, we sometimes check for whether we are on an
* archive page, a search page, etc., allowing for small differences
* in the loop on each template without actually duplicating
* the rest of the loop that is shared.
*
* Without further ado, the loop:
*/ ?>
<?php while ( have_posts() ) : the_post(); ?>
И дальше…
у вас также как и у меня, но это не та строка, которая указано в ЧАВО.
хотя сделал как вы сказали, все получилось!!! СПАСИБО!!!
а какова функция loop?
и как подхатываются файлы?
Это та же строка, только разнесённая по файлу. Функция loop.php — выделить цикл Loop в отдельный файл. Некоторые считают, что так удобнее. Никакие файлы он не подхватывает.
спасибо!
вы писали:
Тогда главная будет подхватывать его
я это имел ввиду, каким образом они подхватываются
спасибо, тему можно закрывать 🙂
зы начинаю понимать как работает WP 🙂
А я так и не уловила,как же убрать некоторые статьи из публикации на главной странице. Я только начала заниматься WordPress-ом, и многое не могу пока уловить.
М.б. распишете по пунктам,как сделать нужную мне публикацию на главной?
Буду признательна!
Статью с главной убрать,но в рубрике оставить!