• Currently I write quite a few drafts. Mostly unfinished, impulse posts that I hope to finish eventually.

    Basically what I am looking for is something similar to list_cats, but that shows the current draft titles(so they can be placed in the sidebar, or wherever). Obviously the idea of a list_drafts is more suited for the feature request section, however I am sure there is a way to do so without that.

    I have tried pulling code from the post.php file, but my knowledge of using WPs variables in content is limited.

    If a post similar to this somehow evaded me in my searches, feel free to redirect me there.

    Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • I have got to say – that I have now lost the plot completely. If its published it is not a draft is it ?

    Thread Starter markmichon

    (@markmichon)

    I simply want to have a list of the current drafts. No links to them or anything, which I know is not possible since they are not published. If you create a few drafts, then go to your post screen you can see that it lists the current drafts that exist. I want to take this and convert it to something that is visible on the site.

    It’s not actually as strange as it may sound.

    I think what he wants is something that pulls back a list of the titles of the posts that are currently drafts (i.e. not published).

    This can be used in various fashion; as a notification of upcoming articles for a magazine for example. Correct me if I’ve gone off the track of course.

    You could do a simple query to pull up your drafts and display them:

    <?php
    $drafts = @$wpdb->get_results("SELECT post_title FROM $wpdb->posts WHERE post_status = 'draft' ORDER BY post_date ASC");
    foreach($drafts as $draft) {
    echo $draft->post_title . '<br />';
    }
    ?>

    Y’know, I could have sworn I saw a plugin somewhere that addressed this issue….

    Ah sorry. With it now. Its titles of drafts. OK.

    Thread Starter markmichon

    (@markmichon)

    Ah, perfect Kafkaesqui. Exactly what I was looking for.

    Stuck an if in there and now it only displays when drafts exist.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Possible way to run a home-made “list_drafts” ?’ is closed to new replies.