I have created a wordpress query which takes the entire content from 1 particular page using the its title
So far i have the following:
<?php
query_posts('pagename=features');
if (have_posts()) :
while (have_posts()) : the_post();?>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile; ?>
<?php else : ?>
<h3 class="center">No Section available</h3>
<p class="center"><?php _e("No Section available"); ?></p>
<?php endif;
//Reset Query
wp_reset_query();
?>
The main issue is that there is numerous pages which care called ‘features’ but they all have different parents. Is it possible to do this via parent somehow?
For example, here is my hierarchical page structure:
products > designgo silver > features
products > designgo silver > screenshots
products > designgo silver > benefits
products > designgo gold > features
products > designgo gold > screenshots
products > designgo gold > benefits
products > designgo platinum > features
products > designgo platinum > screenshots
products > designgo platinum > benefits
If i could do something like:
<?php
query_posts('pagename=features&parent=designgosilver');
if (have_posts()) :
while (have_posts()) : the_post();?>
that would be perfect,
can anyone give us a pointer?
Cheers!
You are almost there—but please, use
WP_Query
.// EDIT:
If you don’t want to or cannot use the parent page’s ID, you can access it by its title, for instance like so: