Get post excerpt on parent page
-
Hi supporters,
On my theme I want to make one category (called “colors”) and then some child’s (calles “red”, “blue”, “yellow”, “green” etc.) and for these child’s some other child’s (“red” > “Violet”, “Pink” etc.) and (“yellow” > “Orange” etc.)
All is pages and ordered in parents and child’s.
How do I get the excerpt from the child-page on the parent-page (the Violet-excerpt on the “red”-parent-page).
Here is my code:
<?php
$categoriesCF = get_post_meta($post->ID, “categories”, true);
// example value = “Sprockets|92,Sprunklers|94”$allCategories = explode(“,”, $categoriesCF);
// $allCategories[0] = “Red|92”
// $allCategories[1] = “Blue|94”foreach ($allCategories as $category) {
$pieces = explode(“|”, $category);
// $pieces[0] = “Red”
// $pieces[1] = 92$link = get_permalink($pieces[1]);
echo “<div class=’product-group group’>”;
echo “<h2>” . $pieces[0] . “</h2>”;
echo “<div class=’kursus-beskrivelse’><?php the_content(); ?>”;query_posts(“posts_per_page=-1&post_type=page&post_parent=$pieces[1]”);
while (have_posts()) : the_post(); ?>
<?php echo “<img src='” . get_post_meta($post->ID, “pictogram”, true) . “‘ />”; ?>
<span class=”product-title”><?php the_title(); ?></span>
<span class=”product-code”><?php echo get_post_meta($post->ID, “product_code”, true); ?></span><?php endwhile; wp_reset_query();
echo “</div>”;
};
?>
- The topic ‘Get post excerpt on parent page’ is closed to new replies.