Всем привет.
Есть блог на движке вордпресс. Два раздела «Новости» и «Акции». На главной странице в блоке «Новости и Акции» выводятся только анонсы записей из раздела «Акции», а анонсы записей «Новости» не выводятся.
Хочу, чтобы на главной в блоке «Новости и Акции» выводились записи, как из раздела «Новости», из «Акций». Пож-ста, помогите настроить.
Код на главной:
<h2>Новости и акции</h2>
<? $lastpromo = new WP_Query('posts_per_page=2&cat='.$promo, $news);
while($lastpromo->have_posts()){ $lastpromo->the_post();?>
<div class="bigblock">
<?php if(has_post_thumbnail()) { ?>
<div class="thumblock">
<a href="<?php the_permalink(); ?>"><? the_post_thumbnail('article'); ?></a>
</div>
<? } ?>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<noindex><?php kama_excerpt("maxchar=150"); ?></noindex>
</div>
<? } wp_reset_postdata(); ?>
<div class="art">
Код из раздела Акций:
<!-- Статья акций -->
<? $lastpromo = new WP_Query('posts_per_page=10&cat='.$promo);
while($lastpromo->have_posts()){ $lastpromo->the_post();?>
<div class="action">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php if(has_post_thumbnail()) { ?>
<a href="<?php the_permalink(); ?>"><? the_post_thumbnail('article', array('class' => 'alignleft')); ?></a>
<? } ?>
<noindex> <p><?php kama_excerpt("maxchar=150"); ?></p></noindex>
<span class="com right"><?php comments_popup_link('0', '1', '%'); ?></span>
<a href="<?php the_permalink(); ?>">подробнее</a>
<div class="break"></div>
</div>
<? } wp_reset_postdata(); ?>
<!-- /Статья акция -->
<a class="allgame right" href="/action/">→ Все акции</a>
</div>
Код из раздела «Новости»:
<h2 class="newsarc"><span>Новости</span></h2>
<div class="break"></div>
<div class="popgamesarch grey">
<!-- Статья популярных -->
<? $lastnews = new WP_Query('posts_per_page=8&cat='.$news);
while($lastnews->have_posts()){ $lastnews->the_post();?>
<div class="action">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php if(has_post_thumbnail()) { ?>
<a href="<?php the_permalink(); ?>"><? the_post_thumbnail('fullarticle'); ?></a>
<? } ?>
<noindex><p><?php kama_excerpt("maxchar=150"); ?><br></noindex>
<a href="<?php the_permalink(); ?>">подробнее</a></p>
</div>
<? } wp_reset_postdata(); ?>
Помогите вывести анонсы новостей на в специальном блоке на главной странице. Сайт на Вордпрессе
(Ответов: 1, Просмотров: 1615)
- 14.09.2013 21:30
- 14.09.2013 21:55
Самая первая строчка из приведенного примера c главной страницы:
PHP код:Это если учесть что в $promo id категории Акции, а в $news id категории Новости.<? $lastpromo = new WP_Query('posts_per_page=2&cat='.$promo.','.$news);
Должно работать
Тэги топика:
Похожие темы
Темы | Раздел | Ответов | Последний пост |
---|---|---|---|
Куда постить анонсы новостей? Соц.сети, блоги... | Общие вопросы поисковой оптимизации | 21 | 25.07.2013 16:02 |
Не могу вывести анонс одной категории в блоке | Drupal | 5 | 12.04.2013 17:42 |
Помогите со скрулом на главной странице в Вордпрессе. | WordPress | 5 | 03.03.2013 04:04 |
Помогите со скрулом на главной странице в Вордпрессе. | Вопросы от новичков | 5 | 03.03.2013 04:04 |
Анонсы новостей на главной | WordPress | 6 | 11.12.2012 14:54 |