php - How to include excerpt in ul from different pages with the same parent - Wordpress -


i wish title, excerpt , meta 3 different pages have same parent.

i not wish specify wich 3 pages show rather show 3 last edited/published.

i aim display content 3 blocks on horizontal line.

as unable code work:

<ul id=""> <?php query_posts("posts_per_page=1&post_type=page&post_parent=4"); the_post(); ?> <li> <img src="<?php echo get_post_meta($post->id, "image", true); ?>" alt="<?php the_title(); ?>" /> <h2><?php the_title(); ?></h2> <?php the_excerpt(); ?> </li> </ul> 

thank dan, still not work though. excrept of first page not show (the title shows , meta also). tried code below same result except second time content displayed, excerpt of first page shows.

<?php get_header(); the_post(); ?> <div id="main-content"> <?php $categoriescf = get_post_meta($post->id, "categories", true); $allcategories = explode(",", $categoriescf); foreach ($allcategories $category) { $pieces = explode("|", $category); $link = get_permalink($pieces[1]); echo "<div class='product-group group'>"; echo "<h3><a href='$link'>" . $pieces[0] . "</a></h3>"; query_posts("posts_per_page=-1&post_type=page&post_parent=$pieces[1]"); while (have_posts()) : the_post(); ?> <a href="<?php the_permalink(); ?>" class="product-jump" title="<?php the_title(); ?>" data-large="<?php get_post_meta($post->id, "image", true); ?>"> <?php echo "<img src='" . get_post_meta($post->id, "image", true) . "' />"; ?> <span class="product-title"><?php the_title(); ?></span> <span class="product-title"><?php the_excerpt(); ?></span></a> <?php endwhile; wp_reset_query(); echo "</div>"; }; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>` 

change posts_per_page 3 , use orderby=date&order=desc 3 recent.

if displaying on page shows other post/page/posts/pages, use get_posts instead of query_posts.

the wordpress codex has full documentation , examples of these things:

http://codex.wordpress.org/function_reference/query_posts

http://codex.wordpress.org/function_reference/get_posts


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -