Hi,
I wanted an editable homepage (so I set up the configuration option that allowed that) but also wanted several articles displayed right below the homepage text.
That globally worked, but I encountered several problems:
- the custom fields do not display
- the content of an article doesn't display (it's the page's content instead that repeats).
(view it live here)
I used conditional tags + this trick to display an homepage + articles (only on homepage)
After the regular page.php loop, I added
<?php if ( is_page('25') ) {
$myposts = get_posts('numberposts=5');
foreach($myposts as $post) :?>
<!-- Flux d'articles pour l'accueil -->
<div class="date">
<?php if (post_custom('date_mois')) {
echo '<span class="daywe">'.post_custom('date_jour_sem').'</span>';
echo '<span class="day">'.post_custom('date_jour_num').'</span>';
echo '<span class="month">'.post_custom('date_mois').'</span>';
} else {} ?>
</div>
<div class="article" id="post-<?php the_ID(); ?>">
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Lien permanent vers <?php the_title_attribute(); ?>"><?php the_title(); ?></a><span class="category"><?php the_category(', ') ?></span></h3>
<?php /*call custom image field*/ if (post_custom('image')) {
echo '<img src="'.post_custom('image').'" alt="illustration" />';
} else {} ?>
<?php the_content('<p class="more">Continuer la lecture »</p>'); ?>
</div>
<?php endforeach; ?>
<?php } ?>
Many thanks in advance for your help!