[resolved] Count all posts made (5 posts)

  1. maerk
    Posted 10 years ago #

    Is there a simple way of getting the number of posts in the database?

    At the moment I'm trying to use:

    $count = $wpdb->get_results('SELECT COUNT(*) FROM wp_posts');

    This isn't working, because $count stays empty.

    It must return a number, because I'm using this later on:

    $remainder = $count - 10;

  2. Mark (podz)
    Support Maven
    Posted 10 years ago #

    The WP-stats plugin there has the right code (and a whole heap more). Might be of use?

  3. maerk
    Posted 10 years ago #

    Thank you, that's perfect :D The code in question (for future folks) is:

    $count = $wpdb->get_var("SELECT COUNT(ID) FROM $wpdb->posts");

  4. DesignPastor
    Posted 10 years ago #

    nice site maerk ...

    what did you use to do the photo gallery.

    i like that ..


  5. maerk
    Posted 10 years ago #

    Thank you! I use eSPG (enhanced Simple PHP Gallery)


    It's currently a bit broken since I completely destroyed it a while ago by overwriting the directory. What you see there is a temporary fix :( I'm planning a redesign shortly, so it seems pointless to do anything too drastic to it just yet, but at least it works.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.