0

Есть страница где выведены записи из категории

<?php
    if ( have_posts() ) :
    query_posts('cat=28');
    while (have_posts()) : the_post(); 
?>
    <div class="post">
        <div class = "news_img">
            <?php the_post_thumbnail(); ?>
        </div>
        <div class="entry-title"><?php the_title(); ?></div>
        <div class="entry-summary">
            <?php the_content(); ?>
        </div>
        <div class = "clearfix"></div>
    </div>
    <?php 
        endwhile;
        endif;
    wp_reset_query();                
    ?>

Как добавить id уникальный каждой записи в блоке .post? можно числовой

3
  • <?= $post->ID; ?> 11 дек 2017 в 17:00
  • и куда это вставить? 11 дек 2017 в 17:11
  • все, разобрался 11 дек 2017 в 17:12

1 ответ 1

0

Разобрался

<?php
    if ( have_posts() ) :
    query_posts('cat=28');
    while (have_posts()) : the_post(); 
?>
    <div class="post" id="<?php the_ID(); ?>">
        <div class="news_img">
            <?php the_post_thumbnail(); ?>
        </div>
        <div class="entry-title"><?php the_title(); ?></div>
        <div class="entry-summary">
            <?php the_content(); ?>
        </div>
        <div class="clearfix"></div>
    </div>
    <?php 
        endwhile;
        endif;
    wp_reset_query();                
    ?>
2
  • Вы там с кавычками напутали 11 дек 2017 в 17:43
  • случайно так вышло. 11 дек 2017 в 18:21

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge you have read our privacy policy.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.