WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] List sub pages with breif description, images

[Resolved] List sub pages with breif description, images

  • bluealien
    Member

    @bluealien

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • bluealien
    Member

    @bluealien

    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; ?>

    bluealien
    Member

    @bluealien

    Ok used wrong code for order…

    used

    order=ASC&

    instead of

    sort_column=menu_order

    bluealien
    Member

    @bluealien

    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; ?>

    Paul
    Member

    @madebypaul

    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!

    EnMiljon
    Member

    @enmiljon

    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

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] List sub pages with breif description, images’ is closed to new replies.