hadis
6 days ago
213
1
General

count(): Parameter must be an array or an object

Posted 6 days ago by hadis

I want to change a html theme to wordpress theme,when I want to show posts I got this error: "Warning: count(): Parameter must be an array or an object that implements Countable in...." and this is the code:

<div class="post-info"><span class="post-category"><a href="#"> سبک زندگی</a></span>
  <header class="post-title">
    <h3 class="serif-font"><a href="#"><?php echo get_the_title(); ?></a></h3>
  </header>
  <div class="post-body">
    <p class="serif-font"><?php  the_content()?></p>
  </div>
<?php
            $args = array(
                    'posts_per_page'=> 3,
                    'offset'=> 0,
                    'category' => '',
                    'category_name' => '',
                    'orderby' => 'post_date' ,
                    'order' => 'DESC',
                    'include' => '',
                    'exclude' => '',
                    'meta_key' => '',
                    'meta_value' => '',
                    'post_type' => 'post',
                    'post_mime_type' => '',
                    'post_parent' => '',
                    'post_status' => 'publish',
                    'suppress_filters' => true,

            );
                $my_posts = query_posts($args);
                foreach ($my_posts as $post){

            ?>

when I use the_content() this error apears! what's the problem?

Please sign in or create an account to participate in this conversation.