WordPress.org

Ready to get started?Download WordPress

Forums

Recent Post display (2 posts)

  1. limecity
    Member
    Posted 7 years ago #

    I made a search and still couldn't solve my problem.

    I got this error msg on my theme:

    Warning: Invalid argument supplied for foreach() in /home/catscity/domains/catscity.com.my/public_html/xu/wp-content/themes/brajeshwar-v70-1/index.php on line 43

    and the line 43 code shows this:

    <h3 class="sec-title">Recent articles</h3>
    <?php
    $posts = get_posts('numberposts=5&offset=1');
    foreach($posts as $post) :
    setup_postdata($post);
    ?>

    why it doesn't work?
    I am using the latest wordpress and a theme called brajeshwar.

  2. MichaelH
    Member
    Posted 7 years ago #

    That error, on a foreach statement, likely means your $posts variable is empty.

    How many actual posts do you have?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.