List af indlæg (posts)

Liste af indlæg.

$posts_to_show = 100; //Max number of articles to display
$debut = 0; //The first article to be displayed
<?php while(have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
$myposts = get_posts('numberposts=$posts_to_show&offset=$debut');
foreach($myposts as $post) :
<li><?php the_time('d/m/y') ?>: <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
<?php endwhile; ?>

Headline of parent and navigation list of children

Display parent headline and a list of children links in a submenu.

In this illustrative example:

  • Services is the parent
  • Service 1, Service 2, and Service 3 is children

The headline in the left column is Services both on parent as well as children page.

And this is the code:

$parent_title = get_the_title($post->post_parent);
echo $parent_title;
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<?php echo $children; ?>
<?php } ?>