WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] List sub pages with breif description, images (6 posts)

  1. bluealien
    Member
    Posted 4 years ago #

    hello,

    I was wondering if someone can help me, Im looking to create a page template that will display the title, image, link and small excerpt of content from all the sub pages listed under that parent page.

    any ideas what im doing wrong with calling to the parent and to have them display based on drop down menu order?

    Code:

    <?php $parent = $post->ID; ?>
                <?php
                query_posts('post_type=page&post_parent='.$parent);
    
                if (have_posts()) :
    
                  $counter = 0; $counter2 = 0;
                  while (have_posts()) : the_post(); 
    
                  $counter++;
                ?>
                <div class="box">
                    <h4 id="latest"><a title="<?php _e('Permalink to ',woothemes); ?> <?php the_title(); ?>" href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h4>
                    <a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"></a>
                    <p><?php print string_limit_words(get_the_excerpt(), 22); ?> &hellip;</p>
                    <p class="post_meta1"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">READ MORE</a></p>
                </div><!-- / #box -->
    
                <?php if ($counter == 0) { ?><div class="fix" style="margin-bottom:20px;"></div><?php } ?>
    
                <?php endwhile; ?>

    thanks for teh help

  2. bluealien
    Member
    Posted 4 years ago #

    any help?

    I got this to work, but issue is it post the full first subchild and I cant get it to go in order based on menu.

    code

    <div style="display:none"><?php the_ID(); ?></div>
            <?php $parent = $post->ID; ?>
            <?php
            query_posts('sort_column=menu_order&post_type=page&post_parent='.$parent);
             while (have_posts()) : the_post();
            ?>
    
            <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
            <p><?php print string_limit_words(get_the_excerpt(), 22); ?> &hellip;</p>
            <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">READ MORE</a></p>
            <p>&nbsp;</p>
            <div style="clear:both"></div>
            <?php endwhile; ?>
  3. bluealien
    Member
    Posted 4 years ago #

    Ok used wrong code for order...

    used

    order=ASC&

    instead of

    sort_column=menu_order
  4. bluealien
    Member
    Posted 4 years ago #

    Ok I got it,

    had issue as it was lopped in other call. Final working version

    Code

    <div style="display:none"><?php the_ID(); ?></div>
            <?php $parent = $post->ID; ?>
            <?php
            query_posts('order=ASC&&post_type=page&post_parent='.$parent);
             while (have_posts()) : the_post();
            ?>
    
            <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
            <p><?php print string_limit_words(get_the_excerpt(), 22); ?> &hellip;</p>
            <p><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>">READ MORE</a></p>
            <p>&nbsp;</p>
            <div style="clear:both"></div>
            <?php endwhile; ?>
  5. Paul
    Member
    Posted 3 years ago #

    Thanks so much for posting this! It really helped me out in developing this site. Its awesome that you found your own solution and took time to post it. Much appreciated!

  6. EnMiljon
    Member
    Posted 3 years ago #

    When I try your final code entry it says "Fatal error: Call to undefined function: string_limit_words() in " and then it specify the line..

    I have searched everywhere for this exact thing, please help

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.