S
S
sld132019-03-01 12:04:56
WordPress
sld13, 2019-03-01 12:04:56

How to display thumbnails of last pages (not posts!) in Wordpress sidebar using php code?

Nowhere on the Web did I find options for displaying pages, and not posts with miniatures in the sidebar using php. The option to learn php is not offered, there is no time. Who can help, thanks.
Here is the code for the posts that needs to be changed:

<ul class="newpost">
        <?php $the_query = new WP_Query('showposts=5'); ?>
                <?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>
        <li>
            <a href="<?php the_permalink() ?>"><?php echo get_the_post_thumbnail( $post->ID, 'thumbnail'); ?></a>
        <a class="title" href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?>        </a><br/>
        </li>
        <?php endwhile; ?>
        <?php wp_reset_query(); ?>
        </ul>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Igor Vorotnev, 2019-03-01
@sld13

Take the code that is for records, only where you 'post_type' = > 'post'change it to 'post_type' => 'page'.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question