• Помогите, пожалуйста. На главной странице все последние записи отображаются полностью, а нужно чтобы были анонсы. Нашел советы на эту тему, предлагают использовать the_excerpt вместо the_content, но в index.php нет такого (the_content). Как быть, помогите. Спасибо.

Просмотр 7 ответов — с 1 по 7 (всего 7)
  • Вот index.php

    <?php global $theme; get_header(); ?>
    
        <div id="main">
    
            <?php $theme->hook('main_before'); ?>
    
            <div id="content">
    
                <?php $theme->hook('content_before'); ?>
    
                <?php
                    if (have_posts()) : while (have_posts()) : the_post();
                        /**
                         * The default post formatting from the post.php template file will be used.
                         * If you want to customize the post formatting for your homepage:
                         *
                         *   - Create a new file: post-homepage.php
                         *   - Copy/Paste the content of post.php to post-homepage.php
                         *   - Edit and customize the post-homepage.php file for your needs.
                         *
                         * Learn more about the get_template_part() function: http://codex.wordpress.org/Function_Reference/get_template_part
                         */
    
                        get_template_part('post', 'homepage');
    
                    endwhile;
    
                    else :
                        get_template_part('post', 'noresults');
                    endif; 
    
                    get_template_part('navigation');
                ?>
    
                <?php $theme->hook('content_after'); ?>
    
            </div><!-- #content -->
    
            <?php get_sidebars(); ?>
    
            <?php $theme->hook('main_after'); ?>
    
        </div><!-- #main -->
    
    <?php get_footer(); ?>

    Эта строчка
    get_template_part('post', 'homepage');
    говорит о том, что требуемый участок кода лежит в файле post-homepage.php, если разработчики Темы чего лишнего не намудрили..

    Нет такого файла ((

    Разобрался. Файлик post.php. Спасибо большое.

    Что мешает его создать?

    Я изменил в post.php the_content на the_excerpt и все нормально.

    говорит о том, что требуемый участок кода лежит в файле post-homepage.php, если разработчики Темы чего лишнего не намудрили..

    Вообще это значит, что сначала проверяется наличие post-homepage.php, а потом (если не оказалось) post.php.

Просмотр 7 ответов — с 1 по 7 (всего 7)

Тема «Анонсы на главной» закрыта для новых ответов.