WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Featured list (5 posts)

  1. Ann-Sophie
    Member
    Posted 3 years ago #

    Hi,

    please take a look at this page.
    It's a slideshow listing every page under "Diensten" + a featured image. I'd like to sort this service according to their ID. (35,37,39,41,43). How can I do this? This is my code:
    <?php

    $mypages = get_posts('include=35,37,39,41,43&sort_column=ID&post_type=page');
                ?>
    
            <div id="feature_list">
    
                <ul id="tabs">
    
                        <?php foreach($mypages as $mypage) : setup_postdata($mypage); ?>
    
                        <li>
                        	<a href="javascript:;">
                        	<h3><?php echo $mypage->post_title; ?></h3>
                        </a>
                    </li>
    
                                <?php endforeach; ?>
    
                </ul>
    
                <ul id="output">
    
                    <?php foreach($mypages as $mypage) : setup_postdata($mypage); ?>
    
                        <li>
                                <?php
                            if ( has_post_thumbnail($mypage->ID) ) { // check if the post has a Post Thumbnail assigned to it.
                                        echo get_the_post_thumbnail( $mypage->ID, 'large');
                                        }
                                        ?>
                            <a href="<?php echo get_permalink($mypage->ID); ?>" title="<?php echo esc_attr(strip_tags(get_the_title($mypage->ID))) ?>">Meer informatie ยป</a>
                                        </li>
    
                    <?php endforeach; ?>
    
                        </ul>
    
            </div><!-- end feature_list -->
  2. MichaelH
    Member
    Posted 3 years ago #

  3. Ann-Sophie
    Member
    Posted 3 years ago #

    Hey,

    I tried what you posted in the other topic, but it doesn't work. The order is still the other way round... My code is now this:

    <?php
                $mypages = get_posts('include=35,37,39,41,43&orderby=ID&post_type=page');
                ?>
  4. MichaelH
    Member
    Posted 3 years ago #

    That looks okay, but you probably need order=ASC

  5. Ann-Sophie
    Member
    Posted 3 years ago #

    Yes idd that solves the problem! Thanks a lot!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.