WordPress.org

Ready to get started?Download WordPress

Forums

3 special tiles to show recent posts automatically (4 posts)

  1. Komeyl94
    Member
    Posted 10 months ago #

    Hi
    I have 3 tiles up on my home page that shows a picture, the date and title of a post, and I want to show 3 most recent post in them. I tried using <?php query_posts("post_per_page=1"); the_post(); ?> tag on each of them and reset the query using <?php wp_reset_query(); ?> at the end of each tile's code, but all of the tiles shows the one recent post, I mean they show the same thing.
    Plus, I'm using custom fields to store the path of image for each post, but it doesn't work either, I use this code for the image src:<?php echo get_post_meta($post->ID, 'post_image', true) ?>
    `PLEASE help me with these

  2. esmi
    Forum Moderator
    Posted 10 months ago #

    What theme are you using? Where did you download it from?

  3. Komeyl94
    Member
    Posted 10 months ago #

    It's my own theme, I want to convert my own design into wordpress but I don't have any experience on it, cause this is my first wp project.

  4. esmi
    Forum Moderator
    Posted 10 months ago #

    If you want to show three posts, try using query_posts("post_per_page=3"). Also, if this is not the main query/Loop, you should be using WP_Query() - not query_posts().

Reply

You must log in to post.

About this Topic