2

How can I insert the latest articles (blog) on top of the homepage?

I intend with the release of the latest items with image and brief summary of the article.

I made an example (in the attached image) of I intend to do.

I want to have some articles (eg. inside similar box design below).

ps: I'm a beginner, please be patient and simple.

Thanks!!

1
  • "I'm a beginner" or "Thing is not working" is not a valid excuse for learning, but "I'm learning, I'm trying heart & soul, but thing is not working as expected" can be. Just try to get some idea with the following resources: Download TwentyFourteen, and see the code. See WP_Query() and learn how to fetch custom data from the db. And show us what you've done already... nobody will touch your blank sheet of paper, you have to paint it first, somebody can retouch only to fine-tune. Commented Dec 23, 2014 at 4:10

1 Answer 1

0

Edit the home page template and add the following code :

<h2>Recent Posts</h2>
<ul>
<?php
    $args = array( 'numberposts' => '1' );
    $recent_posts = wp_get_recent_posts( $args );
    foreach( $recent_posts as $recent ){
        echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .   $recent["post_title"].'</a> </li> ';
    }
?>
</ul>

I have used <UL> and <li> to list post.... You can use your own html & css to style.

You can use different wordpress functions, One I have used is get_permalink() to get the post URL, similarly you can use get_the_post_thumbnail() to get the featured image of the post.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.