Forum Replies Created

Viewing 196 replies (of 196 total)
  • Thread Starter deko

    (@deko)

    Thanks for the reply, but that code does not work. Here is the error I get:


    Fatal error: Call to a member function on a non-object in /home/post/public_html/index.php on line 75

    Is the problem due to the fact that the code is on the “front page” and not the blog page?

    Can you please explain why this code is failing and how to fix?

    What is $wpdb->get_var ??

    Thanks.


    $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_status = 'publish'");
    if (0 < $numposts) $numposts = number_format($numposts);
    $numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
    if (0 < $numcomms) $numcomms = number_format($numcomms);
    echo $numposts;
    echo "</br>";
    echo $numcomms;

Viewing 196 replies (of 196 total)